AdiTheExplorer
AdiTheExplorer

Reputation: 259

Restkit not saving Objects to CoreData sqlite database

Hi I have setup a project pretty much the same as the Restkit RKGithub example in terms of RKManagedObject store and RKObjectManager and using a RKFetchedResultsTableController to drive the tableview.

I have a rails backend that sends out a JSON payload which is mapped in Restkit.

The issue I have is, that after Rails has sent the Json back to iPhone app; I don't see anything saved to the .sqlite file. I really don't understand this. My project is setup pretty much exactly as the RKGithub example but I don't get the same result out of it.

I am using Restkit 10.0.0. Does that have something to do with this? I looked at the code but I don't understand at which point the data is being stored to the sqlite file.

It all works if I use normal (apple template) core data NSManagedObjectContext etc but not when I use RKManagedObjectStore.

Can you please help. I can provide the code. Just was not sure what part of the code to copy paste.

Upvotes: 0

Views: 535

Answers (1)

AdiTheExplorer
AdiTheExplorer

Reputation: 259

Ok. Figured it out. I started using the RKFetchedResultsTableController I realised that I couldn't use the method

[[RKObjectManager sharedManager].mappingProvider setMapping:ironmanClass forKeyPath:@"stark"];

To set a keypath for my JSON i have to use object mapping.rootkeypath property.

Hence it wasn't mapping anything as it didn't understand the JSON format

Upvotes: 1

Related Questions