Not sure why I get “Missing sentinel in function call?”
NSMutableArray *kkk = [NSMutableArray arrayWithObjects: @"a", @"b", @"cat", @"dog", nil];
ppp = [NSMutableArray arrayWithCapacity:3];
[ppp addObject:[[NSMutableArray alloc] initWithObjects: kkk]]; // <<--- Missing sentinel in function call
[ppp addObject:[[NSMutableArray alloc] initWithObjects: kkk, nil]]; //<<--- change, but it falls out
NSLog(@"Working: %@ %@", [[ppp objectAtIndex:0] objectAtIndex:3], [[ppp objectAtIndex:0] objectAtIndex:2] );
initWithObjects:must be terminated with a trailingnil. Since it is a single object, you should be a able to useinitWithObject:. That said, you will be leaking the array like this. DoThere is one more problem with the piece of code here,
You are creating a three dimensional array. So
is wrong.
should log proper values.
However if you need a two dimensional array based on your log statement, I would say you need to do this instead,