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.
+3
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.
0
source to share