Duck
Duck

Reputation: 35953

iPhone - Core Data : forgetting object

I am inserting new entries to a core data entity using this

newEntry = [NSEntityDescription insertNewObjectForEntityForName:@"myEntity" inManagedObjectContext:context];

after that, I populate newEntry properties but at some point, and before this newEntry is saved to the context, I may want to remove this newEntry from the "buffer" or whatever, so it will not be saved when I commit the changes.

How do I do that? I have tried to use reset and rollback but it had no effect and the object continues to be saved.

thanks

Upvotes: 0

Views: 39

Answers (1)

Thomas Clayson
Thomas Clayson

Reputation: 29925

[context deleteObject:newEntry];

This will remove it from the context.

More information and sample code

Upvotes: 1

Related Questions