CreatorUserRecordID.recordName contains "__defaultOwner__" instead of the UUID shown in the toolbar

Downloading CKRecord from CloudKit and when building the recordName drawing, I see this:

 (lldb) po record.creatorUserRecordID.recordName __defaultOwner__ 

but the toolbar shows the real value.

enter image description here

Why is the difference ?!

I hope I do not need to download just because of this logged in user ??

+5
source share
2 answers

"__ defaultOwner__" means that it belongs to a currently registered iCloud account. Thus, you can replace this with โ€œIโ€ or the personโ€™s name, if you have one. If you want to know the registered user ID of the record, you can use the asynchronous method fetchUserRecordIDWithCompletionHandler.

+4
source

this is mistake

edit this:

 - (void)postMoodFeed:(NSString *)moodFeed { CKRecord *moodRecord = [[CKRecord alloc] initWitenter code herehRecordType:@"Mood"]; moodRecord[@"moodFeed"] = moodFeed`enter code here` [[[CKContainer defaultContainer] publicCloudDatabase] saveRecord:moodRecord completionHandler:^(CKRecord *record, NSError *error) { [self queryMyMood]; }]; } - (void)queryMyMood { // currentUserRecordID is fetched from fetchUserRecordIDWithCompletionHandler: of CKContainer NSPredicate *predicate = [NSPredicate predicateWithFormat:@"creatorUserRecordID = %@", currentUserRecordID]; CKQuery *query = [[CKQuery alloc] initWithRecordType:@"Mood" predicate:predicate]; [[[CKContainer defaultContainer] publicCloudDatabase] performQuery:query inZoneWithID:nil completionHandler:^(NSArray *results, NSError *error) { if (results) { for (CKRecord *eachRecord in results) { // Following logs are all __defaultOwner__ NSLog(@"%@", eachRecord.creatorUserRecordID.recordName); [[[CKContainer defaultContainer] publicCloudDatabase]fetchRecordWithID:eachRecord.creatorUserRecordID completionHandler:^(CKRecord *record, NSError *error) { // All following logs are "Unknown item" error NSLog(@"%@", error); }]; } } }]; } 
0
source

All Articles