So I have found an issue with addObject where instead of appending a value to the end of an array, its just putting in the memory location of my object that I am adding(which i am re-using over and over). The end result is all the values in the array end up being the exact same, which is whatever the last entry was. Obviously, I don't want this.
How can I add a unique object to the array? This is my code to add the object...
[listArray addObject:customer];
listArray is an MSMutable array. Customer is a class with 4 values.
I found this same issue here addObject creates a same value in all array
but that solution gives me an error of 'Thread 1: Program received signal: "SIGABRT".
I create the customer object using the code..
else if ([elementName isEqualToString:@"CustomerListResponse"]) {
NSLog(@"customer element found – create a new instance of Customer class...");
customer = [[CustomerListData alloc] init];
}
Thanks.
addObject:statement. How are you "re-using" the variable?