I decided to start using removeAllObjects
so that I could re-use some of my NSMutableArrays. However, I am finding that the call to removeAllObjects
causes the array to get released and so it crashes when the viewController is displayed for the second time.
I've looked on the web and it seems that some people are saying that removeAllObjects
just clears their array, while others are saying that it also releases the array. Which is true? It appears to release for me, but I find that weird and would expect the behaviour to be just to release the objects within the array. Nothing in the documentation warns of this, which I also find strange.
EDIT: With NSZombies turned on, all I get back is:
- -[__NSArrayM removeAllObjects]: message sent to deallocated instance 0x625e4e0
Basically telling me that because the array was released due to the removeAllObjects, it can't call removeAllObjects second time round... Argh!
Can anyone help please?
Thanks!