recordID.recordName (この例では singleID) があり、queryOp; でクエリを実行したいと考えていました。いくつかの検索と実験の後、このコードをまとめることができました...これは機能しますが、本当に正しいですか、おそらく短いパスがあります。
CKRecordID *wellKnownIDx = [[CKRecordID alloc] initWithRecordName:singleID];
CKReference *singleREX = [[CKReference alloc] initWithRecordID:wellKnownIDx action:CKReferenceActionDeleteSelf];
CKDatabase *publicDatabase = [[CKContainer containerWithIdentifier:@"iCloud.blah"] publicCloudDatabase];
NSPredicate *predicatex = [NSPredicate predicateWithFormat:@"recordID == %@",singleREX];
CKQuery *query = [[CKQuery alloc] initWithRecordType:@"Courses" predicate:predicatex];
CKQueryOperation *queryOp =[[CKQueryOperation alloc] initWithQuery:query];
queryOp.desiredKeys = @[@"record.recordID.recordName"];
queryOp.resultsLimit = 1;
queryOp.recordFetchedBlock = ^(CKRecord *results)
{
NSLog(@"Student Found %@",results.recordID.recordName);
};
queryOp.queryCompletionBlock = ^(CKQueryCursor *cursor, NSError *error)
{
NSLog(@"CKQueryCursor error %@", error);
};
[publicDatabase addOperation:queryOp];