I'm wondering if someone could explain why the retain count of a newly created managed object is 2. Here is the code I'm working with:
NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext];
NSEntityDescription *entity = [[self.fetchedResultsController fetchRequest] entity];
Album *newAlbum = [NSEntityDescription insertNewObjectForEntityForName:[entity name] inManagedObjectContext:context];
NSLog(@"Album retain count: %d", [newAlbum retainCount]);
According to the documentation for the insertNewObjectForEntity method, it returns a newly created autoreleased object. So I would expect the retain count to be 1 instead of 2. Can someone explain?