I have a CCArray with gameobjects. I have to destroy some of them. If I use a CCFOREACH or While, and remove some gameobject from the array, It will compile fine, but some objects could not be used. To solve this problem, I want to make a copy, and destroy all pointers after check if I have to destroy or not, to be sure that I check all of them. So my code is:
CCObject object = NULL;
CCArraycopyOfGameObjects = CCArray::create(listOfGameObjects);
while (copyOfGameObjects~~>count > 0)
object = copyOfGameObjects~~>objectAtIndex(0);
But I’m getting a Fatal Signal 11 in line
CCArray *copyOfGameObjects = CCArray::create(listOfGameObjects);
Why is this happening?
The method is correct or exist another solution better?