cocos2d-x 2.2 wp8 issues with Box2D

cocos2d-x 2.2 wp8 issues with Box2D
0.0 0


Hi guys,

I create a game, ios and android work both fine, so I decide to convert to wp8, the strange thing is THESE code always crush in emulator.

for (b2Body* b = world->GetBodyList(); b; b = b->GetNext())
	if (b && b->GetUserData() != NULL)
		CCSprite *spr = (CCSprite*)b->GetUserData();
        if (spr != NULL) {
            if (spr->getPosition().x < -spr->getContentSize().width)
                // remove self

When I want to loop all the b2Body in the world, always get NULL ‘b’, but it works fine in iOS and android. Does any body have the same problems?


I don’t know if it’s the cause of the crash, but you should not do:


and then do:


because b is now invalid.