自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

關(guān)于iCloud的注冊 到代碼的實現(xiàn)

移動開發(fā) iOS
對于蘋果的用戶來說,iCloud可并不是一個網(wǎng)盤和保存聯(lián)系人的工具那么簡單,從2000年的iTools開始發(fā)展,一直到之前失敗的2008年版MobileMe轉(zhuǎn)型過來的iCloud已經(jīng)發(fā)展出相當強大的功能。

iCloud需要xcode4.2 IOS5 sdk 請先做好準備工作:

[[52949]]

1.需要傳件一個新的app id,要是有了一個的話,保證著個app id 不是一個通配符的那種。

2.創(chuàng)建完成之后,你要做的是開啟這項功能,就跟開發(fā)推送一樣,然后在創(chuàng)建一個新的Provisional Profile

3.選擇工程的summary,滾動到entitlement點擊entitlements,xcode會自動的創(chuàng)建一個*.entitlements

4.點擊創(chuàng)建的*.entitlements,分別把pist列表里的三個字段都添上內(nèi)容,格式為 (Team_ID.com.yourcompany.icloudtest),不要把team_id 跟 app_id弄混了啊,team_id是你創(chuàng)建完P(guān)rovisional的時候,在最前面顯示的那10個字符。

5.然后就可以在delegate里面寫下面的代碼了

  1. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
  2.  { 
  3.  // Override point for customization after application launch. 
  4.  self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 
  5.  
  6. NSFileManager *fileManager = [NSFileManager defaultManager]; 
  7.  // Team-ID + Bundle Identifier 
  8.  NSURL *iCloudURL = [fileManager URLForUbiquityContainerIdentifier:@"ZZZZ826ZZ2.com.yourcompany.icloudtest"]; 
  9.  NSLog(@"%@", [iCloudURL absoluteString]); 
  10.  
  11. NSUbiquitousKeyValueStore *cloudStore = [NSUbiquitousKeyValueStore defaultStore]; 
  12.  [cloudStore setString:[iCloudURL absoluteString] forKey:@"iCloudURL"]; 
  13.  [cloudStore synchronize]; // Important as it stores the values you set before on iCloud 
  14.  
  15. UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,round(self.window.bounds.size.height/4.0),self.window.bounds.size.width,round(self.window.bounds.size.height/8.0))]; 
  16.  myLabel.font = [UIFont fontWithName:@"Marker Felt" size:round(self.window.bounds.size.width/20.0)]; 
  17.  myLabel.numberOfLines = 4
  18.  myLabel.text =[ @"iCloudURL=" stringByAppendingFormat:@"%@", [cloudStore stringForKey:@"iCloudURL"]]; 
  19.  myLabel.backgroundColor = [UIColor clearColor]; 
  20.  myLabel.textColor = [UIColor whiteColor]; 
  21.  myLabel.textAlignment = UITextAlignmentCenter
  22.  [self.window addSubview:myLabel]; 
  23.  
  24. [self.window makeKeyAndVisible]; 
  25.  return YES; 
  26.  } 

 

DEMO下載: iCloudTest

責(zé)任編輯:佚名 來源: Cocoachina
相關(guān)推薦

2012-02-15 09:43:43

iCloud云計算蘋果

2013-10-18 09:50:58

2021-10-04 18:59:41

蘋果iCloudSafari書簽

2015-06-12 10:27:46

2022-05-06 07:52:06

Nacos服務(wù)注冊

2015-03-12 09:51:09

CoreDataiCloud

2022-08-01 07:38:29

代碼開發(fā)

2015-09-14 09:28:47

2015-08-13 10:54:46

2021-08-24 19:01:30

蘋果iCloud郵件CSAM

2012-11-05 10:08:01

蘋果iCloud云應(yīng)用

2011-08-31 16:39:06

Lua調(diào)試器

2015-08-13 10:28:07

Cobjc_msgSen匯編

2017-04-10 18:10:31

2022-11-04 08:22:14

編譯代碼C語言

2010-06-07 14:05:38

Linux串口測試工具

2024-10-07 10:02:28

2018-01-12 15:00:50

iCloudApple ID云服務(wù)

2011-11-24 11:24:45

iCloud云計算蘋果

2022-04-26 05:36:42

服務(wù)治理模式
點贊
收藏

51CTO技術(shù)棧公眾號