I have an ivar, NSMutableArray *bodies;
. I allocate and initialize it inside the init method. Then in another place I'm doing the following:
b2Body *body=_world->CreateBody(&bodyDef);
NSValue *bodyValue=[NSValue valueWithPointer:body];
[bodies addObject:bodyValue];
When I debug the code the body is a valid object but although I add it to the bodies array, the array remains empty. If I do something like this
[bodies addObject:@"An object"];
then the count of the objects in bodies is 1. What might be the problem? I needed a way to store C++ objects into a mutable array.