garethdn
garethdn

Reputation: 12351

Initializing an array of bools - returning null

I'm having a lot of problems initializing an array of bools. When using the NSLog i keep getting (null). I'm trying to set up the mutable array piecesInPlace with 40 NO's. I've tried changing setupArrayWithFalses to YES for testing purposes, and still get (null).

BOOL setupArrayWithFalses = NO;
for (int i=0; i<40; i++) {
    [piecesInPlace addObject:[NSNumber numberWithBool:setupArrayWithFalses]];
}
NSLog(@"Value of object: %@", [piecesInPlace objectAtIndex:0]);

Upvotes: 0

Views: 437

Answers (1)

Zalykr
Zalykr

Reputation: 1524

are you initializing you array?

piecesInPlace = [[NSMutableArray alloc] init];

Upvotes: 5

Related Questions