NSPredicate来自数组的字符串值

时间:2016-03-28 04:12:44

标签: ios swift nspredicate

如何编写NSPredicate以从数组中获取不等于ID的所有值

这是我试图这样做的方式:

var mediaArr: [String] = ["1002971147784767054_3158228926", "1002971147784767054_3158228976", "1002971147784767054_3158228986"]
let query = CKQuery(recordType: "Orders", predicate: NSPredicate(format: "mediaId != %@", self.mediaArr))

1 个答案:

答案 0 :(得分:2)

解决了

let query = CKQuery(recordType: "Orders", predicate: NSPredicate(format: "NOT (mediaId IN %@)", self.mediaArr))