在IOS中过滤带谓词的子实体集合(目标c)?

时间:2016-01-07 17:32:48

标签: ios objective-c core-data

我想在开火日期设置谓词。

实体历史的属性警报是NSorderSet。

enter image description here

NSFetchRequest *fetchRequest = [[NSFetchRequest alloc]initWithEntityName:@"History"];    
NSTimeInterval interval = [[NSDate date] timeIntervalSince1970];
NSDate *tempcurrent = [NSDate dateWithTimeIntervalSince1970:interval];

// fireTime
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"alerts.fireTime < %@", tempcurrent];
[fetchRequest setPredicate:predicate];
[[managedObjectContext executeFetchRequest:fetchRequest error:nil] count];
NSInteger count = [managedObjectContext countForFetchRequest:fetchRequest error:nil];
NSLog(@"%li",(long)count);`

问题是被提取的对象数等于零。没有从核心数据中获取数据。

0 个答案:

没有答案