2015-10-20 33 views
0
CKContainer *c= [CKContainer defaultContainer]; 
CKDatabase *openbase=c.publicCloudDatabase; 

CKDatabase *privateDatabase=c.privateCloudDatabase; 

NSPredicate *predicate=[NSPredicate predicateWithValue:YES]; 
CKQuery *q=[[CKQuery alloc]initWithRecordType:@"Notesss" predicate:predicate]; 

[openbase performQuery:q inZoneWithID:nil completionHandler:^(NSArray<CKRecord *> * _Nullable results, NSError * _Nullable error) { 
    if (error!=nil) { 
     NSLog(@"%@",error); 
    } else { 
     [results enumerateObjectsUsingBlock:^(CKRecord * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 

     NSString *title= [obj valueForKey:@"title"]; 
     if([title containsString:[NSString stringWithFormat:@"%ld",(long)row+1]]){ 
      CKAsset *imageA=[obj valueForKey:@"dataImage"]; 

      dispatch_sync(dispatch_get_main_queue(), ^{ 
       self.imageV.image=[UIImage imageWithContentsOfFile:imageA.fileURL.path]; 
      }); 
     }; 
    }]; 
}}]; 
  1. 是否最新要求從iCloud?
  2. 當我從iCloud請求時,可以使用SDWebImage嗎?

回答

0

你是什麼意思? CloudKit基於iCloud,但並不相同。你想改善什麼?我完全不瞭解你的問題。

在您的代碼中,我看到您已經從CloudKit記錄/ CKAsset中獲取圖像。你還想用它做什麼?當你有CKAsset時,圖像只是手機上的一個文件。你可以隨心所欲地做任何事情。

相關問題