CloudKit - NSPredicate to search for all records containing the specified CKReference in the list of links

I am working on a CloudKit-supported application with a type of Users entry that has the “next” link list attribute. I am trying to build a query so that every user who follows the specified user (that is, those users in which the specified user appears as an entry in the following list of links).

I'm currently trying to build its own NSPredicatefor CKQueryitself:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%@ IN following", [[CKReference alloc] initWithRecordID:currentUserID action:CKReferenceActionNone]];
CKQuery *query = [[CKQuery alloc] initWithRecordType:UserRecordType predicate:predicate];

And CloudKit returns the following error message:

"Unknown Item" (11/2003); server message = "did not find required record type";

I feel that perhaps something quite straightforward may be missing from my predicate. Any help would be greatly appreciated!

+4
2

CONTAINS :

CKReference* recordToMatch = [[CKReference alloc] initWithRecordID:currentUserID action:CKReferenceActionNone];
NSPredicate* predicate = [NSPredicate predicateWithFormat:@"following CONTAINS %@", recordToMatch];

1 , AND .

+5

11 , - , . UserRecordType Cloud Kit. , .

0

All Articles