I am pushing an object on navigation controller but when I return the control from the that view controller it crashes the app.
[self.navigationController pushViewController:chequeDetails animated:YES];
[chequeDetails release];
but when I write the same code with
[self.navigationController pushViewController:chequeDetails animated:YES];
chequeDetails=nil;
[chequeDetails release];
The app does not crash but a slight lag is observed… when i pop back from the check details controller?
If your seconds exaple code, you are not release the
chequeDetailssince callingreleaseon a nil object does not nothing:Normally you can do it this ways:
But only release the
chequeDetailsif you did a alloc, init like:So the full code should be something like: