In Xcode, start a new master-detail project. Call it 'Test'.
Add a new 'File' to it. Make it a UIViewController
file with XIB. Call it TestViewController.
Modify your MasterViewController code in the insertNewObject:
method to say this:
-(void)insertNewObject:(id)sender
{
TestViewController *initViewController = [[TestViewController alloc] initWithNibName:@"TestViewController" bundle:nil];
[self.navigationController pushViewController:initViewController animated:YES];
[initViewController release];
}
Now add a dealloc
method into TestViewController.m and simply call [super dealloc];
Put a breakpoint here and run the app. All should run OK.
However, if you Enable Zombie object, you may get a *** -[TestViewController class]: message sent to deallocated instance 0x7484f20 error
when stepping over [super dealloc]
.
Do you get this as well? I'm on iOS6.0 simulator and came across it trying to debug an issue which has led me to this.
Thoughts appreciated. Is it an iOS bug? Or a simulator bug?
Added TestViewController Code for 'clarity'
-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void)dealloc
{
// Zombie here???
[super dealloc];
}