AAA.m:
- (void)keepCurrentArray:(id)object
{
_currentTest=[[NSMutableArray alloc]init];
[_currentTest addObject:@"one"];
[_currentTest addObject:@"two"];
[_currentTest addObject:object];
NSLog(@"My Array is:%@",_currentTest);
}
Class BBB.m is passing objects to class AAA.
Right now if i'm passing X to the above method so the array will be: one,two,X . Then i'll send it Y and the array will be one,two,Y instead of what i want to accomplish: one,two,x,one,two,y.
Is that because I'm alloc and init _currentTest every time? How can I solve it?
Update:
I had a few suggestions on how to solve this and none of them worked for me. I've created a new project with just the code in the answers and i'm still getting the same result when I try to add the second object i get: one, two, test instead of one,two,test,one,two,test
[kios keepCurrentArray:@"Test"];is being called inside aViewController.m LINE: 114 .I redownloaded the zip file again to make sure. NSlog IS being generated. Maybe you didn't noticed that there's a breakpoing inside ViewController.m?