Why does debugger lldb say object is null in iOS 5.1 simulator?

I can write code like:

_myDataArray = [[NSMutableArray alloc] initWithCapacity : kNum];

for (int i=0; i<kNum; i++) {
    MyData *myData = [[[MyData alloc] init] autorelease];
    pageData.title = [NSString stringWithFormat:@"No.%d line", i];
    [_myDataArray addObject:myData];


There is no simulator in iOS 4.3, but the lldb debugger says _myDataArray is nil

(lldb) po _myDataArray
(NSMutableArray *) $2 = 0x00000000 <nil>


in simulator iOS 5.0 / 5.1, Xcode 4.3.1, but the result in sight is correct.

Xcode 4.3.2 fixes this issue.


source to share

3 answers

I can confirm that we have the same problem with simulator 5.0 and 5.1 using 4.3.1 Xcode. The same code with Xcode simulator 4.2.1 and 5.0 has no problem. Noticed that mutable arrays allocated in the order they are in the .h file - stepping through the .m code in debug mode are fun because the arrays get allocated out of order. Decision? Wait for Apple to fix the problem, report a bug, etc.



I can confirm the same issue with iOS 4.3, 5.0 and 5.1 on both iDevice and Simulator. Upgrading from Xcode 4.3.1 to 4.3.2 does not solve the problem here ...

Reverting to the GDB debugger in the schema settings solves the problem.



I have the same problem with all my projects in simulators 5.0 and 5.1. XCode 4.3.3 fixed this for me.



All Articles