Reputation: 73
This is getting silly and driving me crackers.
I have a small test view controller where I loop through ten questions. The answer get checked and the score goes up or stays the same. This happens in a -(void) checkAnswer. No problem!
Now comes my headache. I have a NSMutableArray declared and @property in .h It's @synthesize in .m
But when I try to add "right' or "wrong" to it in checkAnswer, nothing get added.
[scoreArray addObject:@"wrong"];
NSLog(@"scoreArray checkAnswer: %@",scoreArray);
There is no warnings or errors, just getting (null) from the NSLog.
Tried with no joy.
[self.scoreArray addObject:@"wrong"];
Anyone out there that could help me? I'm sure it's something simple I can't see. Thanks
Upvotes: 3
Views: 3728
Reputation: 1996
Have you initialized array correctly?
scoreArray = [[NSMutableArray alloc] init];
Upvotes: 9