2

how to write NSPredicate to fetch all values that not equals ID's from array

here is how im trying to do this:

var mediaArr: [String] = ["1002971147784767054_3158228926", "1002971147784767054_3158228976", "1002971147784767054_3158228986"]
let query = CKQuery(recordType: "Orders", predicate: NSPredicate(format: "mediaId != %@", self.mediaArr))
2
  • 1
    Did you try? -NSPredicate(format: "NOT(mediaId IN %@)", self.mediaArr)) Commented Mar 28, 2016 at 5:08
  • @Shripada yeap it works now Commented Mar 28, 2016 at 6:00

1 Answer 1

2

solved with

let query = CKQuery(recordType: "Orders", predicate: NSPredicate(format: "NOT (mediaId IN %@)", self.mediaArr))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.