I had a problem this weekend with removing items from a NSMutableDict and reloading items to it. The count was 0 after the reload. I created a image to help better explain. I think my problem is with pointers.
To make things easier to get to I create a new Array in step 2 and go through the mainChracterDict to get to the itemsArray. The users adds and subtracts things from this array and then presses a button to save the current state to a plist and reload data. This replaces the items in the mainCharDict and reloads (refreshes) the mainCharDict.
But when I go to refresh the itemsArray I first say removeAllObjects so I won't add duplicates to the array in other indexes and then do step 4 by reassigning the refreshed items. But my count is now 0 in the itemsArray?
I think because I am working with pointers I am removing the items from the original array since my second array (itemsArray) is just pointing to the objects already in memory? So when I reload the count is 0.
To make things easier to get to I create a new Array in step 2 and go through the mainChracterDict to get to the itemsArray. The users adds and subtracts things from this array and then presses a button to save the current state to a plist and reload data. This replaces the items in the mainCharDict and reloads (refreshes) the mainCharDict.
But when I go to refresh the itemsArray I first say removeAllObjects so I won't add duplicates to the array in other indexes and then do step 4 by reassigning the refreshed items. But my count is now 0 in the itemsArray?
I think because I am working with pointers I am removing the items from the original array since my second array (itemsArray) is just pointing to the objects already in memory? So when I reload the count is 0.