RestKit/RestKit — Issue #574: NSObjects that have nested NSManagedObjects wrong managedObjectContext when returned in didLoadObjects
Author: spenrose
Created: 2012-02-28 16:07:29+00:00
State: open

When you are loading objects backed by CoreData that are nested in objects that are not backed by CoreData they are using a managed object context from a background thread. They are then returned in didLoadObjects with the background thread managed object context.

self.offer == NSObject
self.offer.source == NSManagedObject

```
- (void)objectLoader:(RKObjectLoader*)objectLoader didLoadObject:(id)object
{
self.offer = object;
NSLog(@"Context1: %@", [[[RKObjectManager sharedManager] objectStore] managedObjectContext]);
NSLog(@"Context2: %@", self.offer.source.managedObjectContext);
}
```

Outputs:

```
2012-02-28 10:58:04.012 BiteHunter[77860:16703] Context1:
2012-02-28 10:58:04.012 BiteHunter[77860:16703] Context2:
```