我得了ManagedObject class
分,班里有一个是NSDate
分.我想显示未设置日期的类的所有对象.我试着使用这样的谓词:
NSPredicate *predicate = [NSPredicate predicateWithFormat: @"(date = NIL)"];
但我仍然能得到date
的物体.设置谓词的正确方法是什么?
我得了ManagedObject class
分,班里有一个是NSDate
分.我想显示未设置日期的类的所有对象.我试着使用这样的谓词:
NSPredicate *predicate = [NSPredicate predicateWithFormat: @"(date = NIL)"];
但我仍然能得到date
的物体.设置谓词的正确方法是什么?
我认为这是一个案件敏感性问题.可以使用"nil"或"NULL",但不能使用"nil".这对我来说很好:
NSPredicate *eventWithNoEndDate = [NSPredicate predicateWithFormat:@"endDate = nil"];