I'd like to initialize an array of arrays using NSMutableArray in Objective-C. Here is my init code, I believe it should work, as it's essentially creating an array of objects, except the objects happen to be arrays themselves.
I am getting an EXEC_BAD_ACCESS.
NSMutableArray *aoaNumbers = [NSMutableArray arrayWithObjects:
[NSArray arrayWithObjects:@"5", @"1", @"4", @"8", nil],
[NSArray arrayWithObjects:@"4", @"5", @"8", @"3", nil],
[NSArray arrayWithObjects:@"2", @"4", @"2", @"3", nil],
[NSArray arrayWithObjects:@"7", @"6", @"2", @"3", nil], nil];
Please help me understand what is wrong with this initialization? I believe if I do [aoaNumbers addObject: tempArray], it will work fine, I didn't try that out but I am curious how is it any different from the above initialization. Thank you.