Undistraction
Undistraction

Reputation: 43589

Manually adding ManagedObject using Restkit

How should I manually add a managed object to a Restkit managed Object store? I am using Restkit to seed a SQLite database with series of managed objects. All of Restkit's functionality seems geared towards serialising and deserialising objects, but it doesn't seem to offer an API for manually adding (or removing) objects from its Object Store.

RestKit adds an NSManagedObject(ActiveRecord) category which can be used for retrieving a managed object through various class-methods, however I can find no way of adding a new managed object or deleting one.

Should I pull a reference to the managedObjectContext RestKit's object manager, then manipulate the database directly?

Upvotes: 0

Views: 302

Answers (1)

Amy Worrall
Amy Worrall

Reputation: 16337

Should I pull a reference to the managedObjectContext RestKit's object manager, then manipulate the database directly?

I'm by no means an expert at RestKit, but this seems like the way to go.

I don't think RestKit is trying to replace Core Data, it merely adds some convenience stuff for setting up the database and for converting objects as they come through a web service. Everything you do with them locally is still your responsibility, so use the Core Data methods.

Upvotes: 1

Related Questions