I have 2 arrays: _user.itemList(global) and updatedList(specific to that class).
for(Item *item in _user.itemList) {
if(![item.isLinked isEqualToString: @"YES"] && item != self.item) {
[updatedList addObject:item];
}
}
Item *item = updatedList[0];
item.isLinked = @"YES";
Now, I don't want the value changed in _updatedList to be reflected in _user.itemList till I press save.
But since we're dealing with pointers here, _user.itemList[0]'s isLinked is being set to "YES" immediately after this step. How do I prevent this from happening?
I've already tried mutableCopy- Instead of adding items to updatedList I do so to a new array (copArray) and set updatedList to the values of that array.
updatedItem = [copArray mutableCopy];
This doesn't work.