Matching exact string in cloudkit query

Question

I need to pull the record from cloudkit matching a string.

I have a User record type, with an email field. I have multiple records with the same email, but I can't get the predicate to get me the records.

I've tried all of these:

let predicate = NSPredicate(format: "email = 'julio_ukohgsp_chevez@tfbnw.net'")
NSPredicate(format: "email == %@", argumentArray: [email])
NSPredicate(format: "email IN %@", [email])
NSPredicate(format: "email contains %@", email)
NSPredicate(format: "email = %@", email)
NSPredicate(format: "email == %@", email)

My query specifies the record type:

let query = CKQuery(recordType: "User", predicate: NSPredicate(format: "email == %@", email))

When I do a predicate with value: true, I get all records including the one I want.. I know for sure I have a User with that email, multiple in fact..

What am I missing?

Edit ..

let query = CKQuery(recordType: "User", predicate: NSPredicate(format: "email BEGINSWITH %@", email))

Does work and brings back records, but I want an exact match!

Posted Apr 15, 2016, 12:59 AM UTC

12
Loading comments…