Here are the steps to reproduce:
Using Xcode 4.2 create a new project using Master-Detail Application
Check Use Automatic Reference Counting (ARC), Core Data and select iPad
.
Inside viewDidLoad put this code:
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(goBack)];
backButton.title = @"back";
self.navigationItem.leftBarButtonItem = backButton;
Also put this method somewhere else:
- (void)goBack
{
[self.navigationController popViewControllerAnimated:YES];
}
Inside didSelectRowAtIndexPath on MasterViewController put this code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
MasterViewController* master = [[MasterViewController alloc] init];
master.managedObjectContext = self.managedObjectContext;
[self.navigationController pushViewController:master animated:YES];
}
Add a line and click inside it.
Go back to the main view and click again in the item.
Try to add something or delete in the new view and the following crash occurs:
*** -[MasterViewController controllerWillChangeContent:]: message sent to deallocated instance 0x6d85c30
The same steps don’t occur if you don’t use ARC.
Same error using a modal.
Can anyone confirm this or I’m missing something with the use of ARC?
Seems that enabling zombies with core data causes a few problems, best advice i can give is to enable it only when necessary.