I would recommend creating a managed entity and pasting it into the managed entity context as usual. You will have a reference to the managed entity, i.e.:
GuestInfo* guest = (GuestInfo *)[NSEntityDescription insertNewObjectForEntityForName:@"GuestInfo" inManagedObjectContext:managedObjectContext];
Then, if the user cancels, simply remove it from the context of the managed entity as follows:
[guest deleteInContext:managedObjectContext]
The context of managed objects is designed as a notebook for creating and deleting objects in it as follows.
Another option you can consider is to call:
[managedObjectContext rollback]
if the user cancels. those. you will create a managed entity in the context of the managed entity, but if the user cancels, you will cancel or cancel the state of the context of the managed entity as it was the last time it was saved. See the "Canceling Management" section of Apple's Use of Managed Objects document:
https://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CoreData/Articles/cdUsingMOs.html
Rob b source share