Pushing my view controller twice to navigation controller and simulating memory warning, lead to application crash with error: "message sent to deallocated instance"
I'm pushing view controller by pressing on button:
-(void)buttonPressed
{
MyViewCOntroller *vc = [[MyViewController alloc] init];
[self.navigationController pushViewController:vc animated:YES];
}
- I'm using ARC.
Scenario:
[self buttonPressed];
- Press back button in vc.
[self buttonPressed];
- Press back button in vc
- Simulate memory warning
The crash does not happen if pushing only once.
I tried also to move "vc" to be ivar of parent controller, but the effect is the same...
Maybe this will help, but I'm using custom back button and its selector:
-(void)backButtonPressed
{
[self.navigationController popViewControllerAnimated:YES];
}