Skip to content

Commit

Permalink
Modified asserts in RKObjectLoader processMappingResult to allow sync…
Browse files Browse the repository at this point in the history
…hronous requests.
  • Loading branch information
Julien Grimault authored and blakewatters committed Dec 14, 2011
1 parent d488452 commit a1e2061
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Code/CoreData/RKManagedObjectLoader.m
Expand Up @@ -136,7 +136,7 @@ - (void)deleteCachedObjectsMissingFromResult:(RKObjectMappingResult*)result {


// NOTE: We are on the background thread here, be mindful of Core Data's threading needs // NOTE: We are on the background thread here, be mindful of Core Data's threading needs
- (void)processMappingResult:(RKObjectMappingResult*)result { - (void)processMappingResult:(RKObjectMappingResult*)result {
NSAssert(![NSThread isMainThread], @"Mapping result processing should occur on a background thread"); NSAssert(_sentSynchronously || ![NSThread isMainThread], @"Mapping result processing should occur on a background thread");
if (_targetObjectID && self.targetObject && self.method == RKRequestMethodDELETE) { if (_targetObjectID && self.targetObject && self.method == RKRequestMethodDELETE) {
NSManagedObject* backgroundThreadObject = [self.objectStore objectWithID:_targetObjectID]; NSManagedObject* backgroundThreadObject = [self.objectStore objectWithID:_targetObjectID];
RKLogInfo(@"Deleting local object %@ due to DELETE request", backgroundThreadObject); RKLogInfo(@"Deleting local object %@ due to DELETE request", backgroundThreadObject);
Expand Down
2 changes: 1 addition & 1 deletion Code/ObjectMapping/RKObjectLoader.m
Expand Up @@ -146,7 +146,7 @@ - (void)informDelegateOfObjectLoadWithResultDictionary:(NSDictionary*)resultDict
@protected @protected
*/ */
- (void)processMappingResult:(RKObjectMappingResult*)result { - (void)processMappingResult:(RKObjectMappingResult*)result {
NSAssert(![NSThread isMainThread], @"Mapping result processing should occur on a background thread"); NSAssert(_sentSynchronously || ![NSThread isMainThread], @"Mapping result processing should occur on a background thread");
[self performSelectorOnMainThread:@selector(informDelegateOfObjectLoadWithResultDictionary:) withObject:[result asDictionary] waitUntilDone:YES]; [self performSelectorOnMainThread:@selector(informDelegateOfObjectLoadWithResultDictionary:) withObject:[result asDictionary] waitUntilDone:YES];
} }


Expand Down

0 comments on commit a1e2061

Please sign in to comment.