I am attempting to get a Users' saved data in CloudKit. I can see the record in the CloudKit Dashboard, but am unable to get to it via code in app.
-(void)getUserRecordID {
CKContainer *defaultContainer =[CKContainer defaultContainer];
[defaultContainer fetchUserRecordIDWithCompletionHandler:^(CKRecordID *recordID, NSError *error) {
if (!error) {
[defaultContainer fetchUserRecordIDWithCompletionHandler:^(CKRecordID *recordID, NSError *error) {
self.userRecordID = recordID;
NSLog(@"user record id: %@",recordID);
[self getUserRecord];
}];
}
else {
NSLog(@"error: %@",error.localizedDescription);
}
}];
}
-(void)getUserRecord {
CKContainer *defaultContainer =[CKContainer defaultContainer];
CKDatabase *publicDatabase = defaultContainer.publicCloudDatabase;
[publicDatabase fetchRecordWithID:self.userRecordID completionHandler:^(CKRecord *userRecord, NSError *error) {
if (!error) {
NSLog(@"current coins: %@",userRecord);
}
else {
NSLog(@"error: %@",error.localizedDescription);
}
}];
}
This gets me the User record information, but not the ID's of the saved private records. How can I get them?