0
所以我想通过先设置谓词然后查询数据来从核心数据获取自定义对象。下面是我在做什么:NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(dec LIKE[c] %@", [NSNumber numberWithInteger:[tempItemDec integerValue]]];
NSPredicate,无法解析格式字符串
因此,十二月是NSNumber的和tempItemDec是NSString的,所以我必须先转换成字符串NSInteger的然后包裹整数NSNumber的是能够查询,但得到错误说这个:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse the format string "(dec LIKE[c] %@"'
我能够从数据库中查询项目,如果我使用他们的名字为例,但这我不明白?
任何想法?
我试过[NSPredicate predicateWithFormat:@“(dec LIKE [c]%@)”,但后来又出现了一个错误。 –
什么“其他错误”?看到我的编辑另一个可能的原因。 – omz
现在用@“dec ==%@”工作,但它不适用于LIKE [E]不知道为什么。 –