Reputation: 26913
With this query on the public database:
let pred = NSPredicate(format: "family == %@", ref)
let query = CKQuery(recordType: "Users", predicate: pred)
I get no results, even though I have this reference association on two Users
records.
Even if I try:
let pred = NSPredicate(format: "TRUEPREDICATE")
let query = CKQuery(recordType: "Users", predicate: pred)
Which should return all Users
records, I get nothing. Though I’d understand that Apple might not want the latter, is it also the case that I cannot query for specific Users as well?
I have scoured the documentation, but it's a little lacking currently and cannot find any conditionals about this. Users
is a special recordType, so perhaps the answer is simply "No you cannot query for Users".
Thanks.
Upvotes: 0
Views: 112
Reputation: 3950
User records are explicitly not queryable. You must use CKDiscoverUserInfosOperation
, CKDiscoverAllContactsOperation
, -[CKContainer discoverUserInfo...]
or -[CKContainer discoverAllContactUserInfosWithCompletionHandler]
to find a user record.
If you need to query on an attribute of a user you'll need to create a new record type and store the property in there. You can use creatorUserRecordID
on your custom record to associate that value with the user.
Upvotes: 2