I have no idea why, but my NSMutableArray ‘items’ will not take more than 5 elements.
Can someone please help? I’m following the Big Nerd Ranch iOS Programming book.
This code works fine:
NSMutableArray *items = [[NSMutableArray alloc] init];
for (int i = 5; i < 10; i++) {
BNRItem *p = [BNRItem randomItem];
[items addObject:p];
}
However if I change the initial value of i to 4 or less the program crashes when exiting the for loop:
NSMutableArray *items = [[NSMutableArray alloc] init];
for (int i = 4; i < 10; i++) {
BNRItem *p = [BNRItem randomItem];
[items addObject:p];
}
Error screenshot: http://db.tt/3CdueSYh
Change your
to:
You forgot
@before"Mac"Hope it helps