问题很麻烦。输入fetchObjectsForEntityName时,给了一个警告:
No visible @interface for 'NSManagedObjectContext' declares the selector 'fetchObjectsForEntityName:withPredicate:'
代码:
-(SyncObject *)objectWithSyncID:(NSString *)syncID inContext:(NSManagedObjectContext *)context {
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"syncID == %@", syncID];
NSSet *set = [context fetchObjectsForEntityName:@"SyncObject" withPredicate:predicate];