I’m posting objects on a server as JSON that consists of a few attributes and an ID that is the primary key attribute. I’m also using Core Data to save all the objects locally.
The problem is that when I first create the object to POST I know all the attributes but the unique ID. The ID is set at server-side, and when I get the response from the server I have ended up with two objects in my database:
One with ID 0, and one with the real ID.
Is there any way to get restkit/coredata to treat these two objects as the same, or alternatively don’t save the first object in the database?
You can use the
postObject: usingBlockmethod and assign a target object for the object loader like this.Note that you also have to set the delegate manually in the block of code every time you run the method.