How to discard CoreData changes in one object when RKObjectManager failed to post object
I know nothing about RKObjectManager
, but in order to discard changes to NSManagedObject instance you could call:
[object.managedObjectContext refreshObject:object mergeChanges:NO]
This will discard all changes and turn the object into fault.
see here
Swift solution:
import CoreData
extension NSManagedObject {
func cancelChanges() {
managedObjectContext?.refresh(self, mergeChanges: false)
}
}
Using:
object.cancelChanges()