Skip to content

Instantly share code, notes, and snippets.

@ajmaradiaga
Created April 27, 2011 01:49
Show Gist options
  • Save ajmaradiaga/943582 to your computer and use it in GitHub Desktop.
Save ajmaradiaga/943582 to your computer and use it in GitHub Desktop.
Instance a NSManagedObject without inserting in ManagedObjectContext
//Assuming Accounts = Name of the Entity to instance
BlipAppDelegate *_appDelegate = (BlipAppDelegate *)[[UIApplication sharedApplication] delegate];
NSManagedObjectContext *MOC = [_appDelegate managedObjectContext];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Accounts" inManagedObjectContext:MOC];
Accounts *account = (Accounts *)[[NSManagedObject alloc] initWithEntity:entity insertIntoManagedObjectContext:nil];
//Insert data to account
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment