I have a view controller that i'm trying to push onto the navigation stack. I create the controller with a local variable, set it up, then assign it to a property. Then if I release the variable, I get EXE_BAD_ACCESS. if I retain (or auto release) it leaks.
CustomTVC* controller = [[CustomTVC alloc]initWithStyle:UITableViewStyleGrouped];
controller.managedObjectContext = self.managedObjectContext;
self.tableViewControllerIvar = controller;
[self.navigationController pushViewController:self.tableViewControllerIvar animated:YES];
//[controller autorelease]; or [controller release]; or nothing
Here is exactly what happens if I release
- The above code is fired from pushing an add button in the nav bar.
- the view is pushed and everything is fine. In the new view I can push more views in over and over with no problem...unless
- I go back to the root view of the navigation stack. (Which is where the above code is from).
- Now if I drill down again to the second view, then try to push another it crashes.
Edit: I have a feeling that something is going wrong when I push the third controller onto the stack. With the push, it's inserting a new object into the managed object context which is causing the fetchedresultscontroller to update the tableview. There may be a broken pointer in there somewhere. I'll play with it and post the results. –
Edit: 5/16
Getting this error message in the log
* -[CustomTVC controllerWillChangeContent:]: message sent to deallocated instance 0x187270
This only happens after I pop the CustomTVC off the stack (go back to the navigation root view controller) I can push and save all I want as long as I don't pop the CustomTVC.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…