Initialization of NSMutableArray in a loop
I have an IBAction like this:
if([checkinArray count]!=0){
[checkinArray removeAllObjects];
}
loop{
Checkin *checkinsA = [[Checkin alloc] init];
.....
[checkinArray addObject:checkinsA];
[checkinsA release];
}
And when checkinArray is not empty I am getting exc bad access error and the app is crashing. What I am doing wrong here? What I am trying to do is to empty the array and then refill ti with updated data. PS. The checkin array is de开发者_运维技巧clared in .h and is initialized on viewdidload.
精彩评论