I found a solution that worked for me (I'm not sure how applicable it is to your situation, but I am adding it as an answer, since it solved this (or very similar) problem for me):
A few days ago, I launched the RKTwitterCoreData example and noticed that it works fine, while mine, with very simple code at the moment and doing almost the same thing, didnβt. I have many failed errors. So I decided to modify all my RestKit related code to reflect how the RKTwitterCoreData example RKTwitterCoreData .
I am breaking it into pieces to try to help you follow my line of thinking at the time (since I do not think our problems are identical).
My assumption about initial implementation
Since RestKit can return objects to Core Data, I suggested that these managed objects can be used interchangeably. For example, I could use objects from Core Data in the same way as those that were retrieved from a remote web service. I could combine them together to get all the data.
I was wrong
I noticed that the RKTwitterCoreData code RKTwitterCoreData not go this way at least. A decent piece of my code matched them, but the biggest difference was that they did not consider these objects interchangeably. In fact, they never used objects that they received from remote data stores. Instead, they simply allow you to "fall through the cracks." I can only assume that they are added to the Core Data repository, as they work for them, and now for me.
More details
My application worked after changing my code to use this thread. I can only then assume that the unrealizable errors that we see are related to the use of Core Data-enabled objects that we return from the web service. If instead you simply ignore them and then fetch, you will get everything back (including the most recent request) and you should not get any unexecutable errors.
To develop, if you look at the RKTwitterViewController , you will notice that lines 45-61 handle loading objects:
- (void)loadObjectsFromDataStore { [_statuses release]; NSFetchRequest* request = [RKTStatus fetchRequest]; NSSortDescriptor* descriptor = [NSSortDescriptor sortDescriptorWithKey:@"createdAt" ascending:NO]; [request setSortDescriptors:[NSArray arrayWithObject:descriptor]]; _statuses = [[RKTStatus objectsWithFetchRequest:request] retain]; } - (void)loadData {
Everything looks fine (at least compared to the way I did this download initially). But look at the delegate method objectLoader:didLoadObjects: ::
- (void)objectLoader:(RKObjectLoader*)objectLoader didLoadObjects:(NSArray*)objects { [[NSUserDefaults standardUserDefaults] setObject:[NSDate date] forKey:@"LastUpdatedAt"]; [[NSUserDefaults standardUserDefaults] synchronize]; NSLog(@"Loaded statuses: %@", objects); [self loadObjectsFromDataStore]; [_tableView reloadData]; }
The sample does not even touch the objects parameter! (Besides NSLog , of course ...)
Conclusion / TL; DR
Do not use managed objects that you return to objectLoader:didLoadObjects: as if they were fully supported by Core Data. Instead, ignore them and retrieve them from Core Data. All objects, including those received from the last request. Otherwise, you will get fatal errors (at least I did it).