有时我得到错误,说无法识别的选择器objcType被发送到一个NSDate对象:
2011-06-11 14:44:51.589 MyApp [354:307] - [__ NSDate objCType]:无法识别的选择器发送到实例0x4b0d5a0
2011-06-11 14:44:51.732 MyApp [354:307] *由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' - [__ NSDate objCType]:无法识别的选择器发送到实例0x4b0d5a0'
我所做的是通过调用使用Core Data从sqLite加载数据[[self fetchedResultsController] performFetch:&error].我使用谓词,它确保获取具有指定范围内kickoffTime类型属性的唯一(NSManaged)对象NSDate:
NSDate * fromDate = ...
NSDate * toDate = ...
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"( ( %@ <= kickoffTime +0 ) && ( kickoffTime +0 <= %@ ) )", fromDate, toDate];
// Add the predicate to the fetchRequest
[[[self fetchedResultsController] fetchRequest] setPredicate:predicate];
NSError *error;
if (![[self fetchedResultsController] …Run Code Online (Sandbox Code Playgroud)