What kind of error did you get?
You should check that:
- All user data are set with a CCSprite instance (if not your cast is incorrect).
- All CCSprite objects have been added to a parent layer/scene (if not they're auto released and the pointer is invalid).
BTW you don't want to update the sprite if the body is static. It's useless.
if (b->GetType() != b2_staticBody && b->GetUserData() != NULL)
Hope it helps, Laurent