mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-24 04:46:01 +08:00
Allow assertion to pass if localObject is returned nil
This commit is contained in:
@@ -386,10 +386,11 @@ static inline NSManagedObjectID *RKObjectIDFromObjectIfManaged(id object)
|
||||
if (objectID) {
|
||||
if ([objectID isTemporaryID]) RKLogWarning(@"Performing object mapping to temporary target objectID. Results may not be accessible without obtaining a permanent object ID.");
|
||||
NSManagedObject *localObject = [self.managedObjectContext existingObjectWithID:objectID error:&blockError];
|
||||
NSAssert([localObject.managedObjectContext isEqual:self.managedObjectContext], @"Serious Core Data error: requested existing object with ID %@ in context %@, instead got an object reference in context %@. This may indicate that the objectID for your target managed object was obtained using `obtainPermanentIDsForObjects:error:` in the wrong context.", objectID, self.managedObjectContext, [localObject managedObjectContext]);
|
||||
NSAssert(localObject == nil || [localObject.managedObjectContext isEqual:self.managedObjectContext], @"Serious Core Data error: requested existing object with ID %@ in context %@, instead got an object reference in context %@. This may indicate that the objectID for your target managed object was obtained using `obtainPermanentIDsForObjects:error:` in the wrong context.", objectID, self.managedObjectContext, [localObject managedObjectContext]);
|
||||
if (! localObject) {
|
||||
RKLogWarning(@"Failed to retrieve existing object with ID: %@", objectID);
|
||||
RKLogCoreDataError(blockError);
|
||||
return;
|
||||
}
|
||||
self.mapperOperation.targetObject = localObject;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user