Objective c 使用天花板功能预测
我正在尝试为NSPredicate使用天花板功能。到目前为止,以下是我的代码片段:Objective c 使用天花板功能预测,objective-c,ios,cocoa,nspredicate,Objective C,Ios,Cocoa,Nspredicate,我正在尝试为NSPredicate使用天花板功能。到目前为止,以下是我的代码片段: self.filterPredicateTemplate = [NSPredicate predicateWithFormat:@"ceiling(($_NOW_INTERVAL - dateupload) / 3600) == $_INTERVAL"]; - (NSDictionary *)dictionaryForPredicateTemplate:(id)value { NSNumber *
self.filterPredicateTemplate = [NSPredicate predicateWithFormat:@"ceiling(($_NOW_INTERVAL - dateupload) / 3600) == $_INTERVAL"];
- (NSDictionary *)dictionaryForPredicateTemplate:(id)value {
NSNumber *interval = [NSNumber numberWithDouble:[[NSDate date] timeIntervalSince1970]];
return [NSDictionary dictionaryWithObjectsAndKeys:value, @"_INTERVAL", interval, @"_NOW_INTERVAL", nil];
}
NSPredicate *predicate = [self.filterPredicateTemplate predicateWithSubstitutionVariables:[self dictionaryForPredicateTemplate:key]];
NSArray *a = [self.list filteredArrayUsingPredicate:predicate];
最后一行抛出此错误:
“NSInvalidArgumentException”,原因:“-[NSCFString objCType]:
已将无法识别的选择器发送到实例0x4e1f060'
我不知道该错误,正在这里寻求帮助。请显示dateupload方法的定义。听起来要么值不是您期望的值,要么在调用filteredArrayUsingPredicate之前释放了其中一个值。@DaveDeLong dateupload是NSDictionary对象的一部分,它是一个数值。