【发布时间】:2012-09-14 02:50:16
【问题描述】:
为这个寻找高低,但找不到我的答案。我正在寻找不等于指定字符串的所有记录的核心数据。例如,所有不等于当前会话 ID 的记录。我试过这些都无济于事:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"listingID != %@", [sitListingID objectAtIndex:i]];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%@ NOT CONTAINS[cd] %@",@"listingID", [sitListingID objectAtIndex:i]];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%@ NOT CONTAINS %@",@"listingID", [sitListingID objectAtIndex:i]];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"listingID NOT like %@", [sitListingID objectAtIndex:i]];
没有任何作用。HEEEEELP!!! -------------------------------------------------- --- 更多代码
NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"ListingRecord" inManagedObjectContext:context];
[request setEntity:entity];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"sessionID <> %@", uniqueSessionListings];
[request setPredicate:predicate];
NSError *error = nil;
NSMutableArray *mutableFetchResults = [[context executeFetchRequest:request error:&error] mutableCopy];
【问题讨论】:
-
你能提供一个完整的方法吗?可能是您获取空数据。
标签: ios core-data nspredicate