我正在使用这段代码从核心数据中获取一些东西:
NSFetchRequest *req = [[NSFetchRequest alloc] initWithEntityName:@"Friend"];
NSString *predicateString = [NSString stringWithFormat:
@"identifier == %@", [[friendInfo objectForKey:@"id"] stringFromMD5]];
NSPredicate *predicate = [NSPredicate predicateWithFormat:predicateString];
req.predicate = predicate;
req.fetchLimit = 1;
NSError *requestError = nil;
NSArray *tmp = [self.managedObjectContext executeFetchRequest:req error:&requestError];
但它崩溃了
NSString *predicateString = [NSString stringWithFormat:
@"identifier == %@", [[friendInfo objectForKey:@"id"] stringFromMD5]];
如果我删除 stringFromMD5 方法调用,它可以工作。
NSString *predicateString = [NSString stringWithFormat:
@"identifier == %@", [friendInfo objectForKey:@"id"]];
知道为什么吗?谢谢