佚名通过本文主要向大家介绍了coredata,ios coredata,coredata数据库,coredata是什么,ios coredata 使用等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题:中通快递网点查询派送范围查询 在coreData中查询一个NSNumber字段
描述:
解决方案1:
描述:
需求是这样的要在本地数据库中获取全部ctype为7的数据
数据库中的ctype类型为NSNumber
以下是我的代码 大部分能正确运行 在少数我不知道原因的情况下会crash
NSPredicate *predicate = [NSPredicate predicateWithFormat: @"ctype CONTAINS %@", @"7"];
控制台输出的信息是
Can't use in/contains operator with collection 7 (not a collection)
我应该如何改进这段代码呢?
解决方案1:
NSNumber
直接用双等号:
[NSPredicate predicateWithFormat:@"ctype == %@", @7]