Chr*_*jær 2 sqlite core-data objective-c nspredicate nsfetchrequest
我正在尝试创建一个NSPredicate(用于a NSFetchRequest中的核心数据NSFetchedresultsController),根据当前时间过滤记录.
不是谓词创建的时间:
[NSPredicate predicateWithFormat:@"(criticalDate < %@)", [NSDate date]]
但是评估谓词的时间,因为我想避免一直使用新的fetchRequests更新fetchedResultsController.我正在寻找的东西(但我自己找不到)是这样的:
[NSPredicate predicateWithFormat:@"(criticalDate < ????)"]
这是为iPhone,这意味着now()不支持,所以我想无论解决方案是什么,它将是一种黑客攻击.
提前致谢
你想用:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"criticalDate < now()"];
Run Code Online (Sandbox Code Playgroud)