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];
});
};
}];
}}];
答案 0 :(得分:0)
在您的代码中,我看到您已经从CloudKit记录/ CKAsset获取图像。你还想用它做什么?拥有CKAsset的那一刻,图像只是手机上的一个文件。你可以用它做任何你想做的事。