CoreData fetch'无法在swift 3中使用in / contains运算符和收集错误

时间:2017-06-06 09:14:34

标签: ios core-data swift3

我有User表,你可以在下面看到

id (Int)
name (String)
no (String)
number (Int)

我想用;

获取它
let predicate = NSPredicate (format:"name CONTAINS[cd] (%@) || no CONTAINS[cd] (%@) && number == 5",search.text!, search.text!) 

给我;

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Can't use in/contains operator with collection 0 (not a collection)'

错误,我该如何解决?我想通过输入搜索文本来搜索名称和无字符串。

0 个答案:

没有答案