I am importing a good amount of data into my application using Core Data like so:
for (int i = 0; i < [items count]; i++)
{
Client *entity = (Client*) [NSEntityDescription insertNewObjectForEntityForName:@"Client" inManagedObjectContext:managedObjectContext];
[entity setCompanyName:[[items objectAtIndex:i] objectForKey:@"CompanyName"]];
//* bunch of other fields
NSError *error;
if (![managedObjectContext save:&error]) {
// Handle the error.
NSLog(@"%@",error);
}
}
What do I need to be releasing here? should I be doing [entity release]?
As the documentation says:
So the answer is no, you don’t need to release the
entityvariable.Note this is the standard. When using a convenience method, returned instances are auto-released by convention, so you don’t need to care about them, unless you explicitly retain them, of course.