Search code examples
iphoneiosxcodedebuggingviewdidload

Xcode 4.2 debugging on a viewDidLoad or viewDidDisappear will end on a EXC_BAD_ACCESS


Xcode 4.2 debugging on a viewDidLoad or viewDidDisappear will end on a EXC_BAD_ACCESS

It breaks on that breakpoint but when continuing ("Continue program execution") it returns a: EXC_BAD_ACCESS (code=1, address=0x....) on Thread 1 (0 start). That did not happen in earlier versions.

Someone getting the same error? Somebody knows how to deal with it?

Code for the example would be a simple:

 - (void) viewDidDisappear:(BOOL)animated {  
       [super viewDidDisappear:animated];
        NSLog(@"View did dissapear");    
    }

When debugging on breakpoint (line with NSLog) it and then hitting on continue it will end on that EXC_BAD_ACCESS. If no breakpoint then everything works fine.

I am working with Xcode 4.2 Build 4D199 (OS X Lion 10.7.2). Using LLDB debugger.

UPDATE: put a break in all exceptions and it always ends on a Thread 8: EXC_BAD_ACCESS - 0x1f43: movl (%ebx), %eax - line 0: start....

UPDATE 2: played around with Xcode and I really don´t know why but know it works. No code changed... hmmm... strange...


Solution

  • You must always call through to super at some point in all of the viewWill... or viewDid... methods that you override. For example,

    - (void) viewDidDisappear:(BOOL)animated {
            NSLog(@"View did disapear");
            [super viewDidDisappear:animated];
    }