I'm trying to create a NSMutableArray within a function that continuously runs, and initialize its values just once so that it doesn't keep initializing the values (thus replacing the changed values) as the function is repetitively called. My problem is when I try to initialize the values in an if statement the values in the array won't change, it keeps printing "value is 0" when I'm expecting it to be printing "value is 1"
Here's my relevant code:
@property (nonatomic, strong) NSMutableArray * shapeMarked;
@synthesize shapeMarked;
//locationManager is the function that's continuously called
-(void) locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
//event count is an integer that continuously increases by one each time the
//parent function is called, this if statement is used so that it only happens
//once
if(eventcount == 1){
for (int i = 0; i < 5; i++){
BOOL b = YES;
[shapeMarked addObject:[NSNumber numberWithBool:b]];
NSLog(@"value is %d", [[shapeMarked objectAtIndex:i] boolValue] );
}
}
}