Using restkit, I'm POSTing to a server and getting back objects. One of the properties on these objects is a timestamp when the object was received.
My current implementation is to loop through the objects in the mapping result array of the RKObjectManager's postObject success block and if the object doesn't have the received timestamp, I add it and save the object, doing this:
NSError *error;
if (![object.managedObjectContext saveToPersistentStore:&error]) {
// handle the error here
}
I have an inkling there's a better way to do this, and I actually think this might be causing some other issues but I'm not sure. Can I simply call save instead of saveToPersistentStore? Will doing the following be better or worse for any reason?
NSError *error;
if (![object.managedObjectContext save:&error]) {
// handle the error here
}
Also, if there are numerous objects in this mapping array will calling this in a loop n times be problematic?