I’m doing this :
for(int k=0;k<[dataWord count];k++)
{
NSNumber *num=[NSNumber numberWithInt:2] ;
[preDataWord insertObject:num atIndex:k ];
}
when preDataWord is allocated before .
later when I’m trying to use this array I get all zero’s.
Why is that? Do i have to retain it? How?
EDIT :
on my init i have preDataWord=[[NSMutableArray alloc]init];
where preDataWord is declared in the class interface .
this class is running in another thread(audio unit) .
when i log the array right after the for loop, i can see its full and just fine.
later when another function trying to use it, she sees 0….
Without seeing the preDataWord ivar I’d first make sure it’s declared and allocated properly:
And inside your for loop, add your NSNumber object to preDataWord like so: