0

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];
}
Fittoburst
  • 2,215
  • 2
  • 21
  • 33

1 Answers1

0

I guess that your TestViewController has outlets and properties. If any of those properties/outlets are over released it will cause this error. Make sure that [super dealloc] is the last line on you dealloc method too

Siby
  • 318
  • 1
  • 10
  • Thanks but have you tried this? There's nothing extra other than what is automatically added by xCode. It's worth a try to see if you get the same result. – Fittoburst Jan 04 '13 at 09:08
  • I tried it and is working as you said exactly. It happens only in debug stop on super with zombies. I wont be too worried abt it. It may be a debugger glitch. If I am too worried i may add self = nil after [super dealloc] – Siby Jan 04 '13 at 21:24
  • Thanks Siby. At least I know I'm not going mad. Thanks for your time. – Fittoburst Jan 05 '13 at 08:31