Search code examples
ioscachingrestkit

Prefill RestKit cache


I'd like to ship the app with a file already in the RestKit's cache. How can that be done? Alternatively, is it possible with RestKit to deserialize a json file from the app bundle?


Solution

  • Are you using CoreData in your App? If so you want to look at the the RKManagedObjectSeeder, which allows you to use jSON text files to populate a seed database which can be shipped with your App.

    Alternatively, if not using CoreData, I think you can get it to read JSON text files on launch, but I haven't needed that.

    Have a look at the RESTKit Twitter example that comes with RESTKit, as I believe it has what you need in there.