Cocos2d iphone 将Cocos2d代码转换为ARC问题

Cocos2d iphone 将Cocos2d代码转换为ARC问题,cocos2d-iphone,automatic-ref-counting,box2d-iphone,Cocos2d Iphone,Automatic Ref Counting,Box2d Iphone,我正在尝试启用ARC项目,在为ARC选择文件时遇到了一些问题 在Ball类中,以下行 ballBody->SetUserData(self); enemyBody->SetUserData(enemySprite); 给出了错误 Cannot initialize a parameter of type 'void *' with an Ivalue of type 'Ball *const__strong' Cannot initialize a parameter of t

我正在尝试启用ARC项目,在为ARC选择文件时遇到了一些问题

在Ball类中,以下行

ballBody->SetUserData(self);
enemyBody->SetUserData(enemySprite);
给出了错误

Cannot initialize a parameter of type 'void *' with an Ivalue of type 'Ball *const__strong'
Cannot initialize a parameter of type 'void *' with an Ivalue of type 'CCPhysicsSprite*__strong'
在敌方.mm类中,以下行

ballBody->SetUserData(self);
enemyBody->SetUserData(enemySprite);
给出了错误

Cannot initialize a parameter of type 'void *' with an Ivalue of type 'Ball *const__strong'
Cannot initialize a parameter of type 'void *' with an Ivalue of type 'CCPhysicsSprite*__strong'
在敌军.h中,我将上述定义为:

b2Body* enemyBody;
CCPhysicsSprite* enemySprite; (in Enemy.m)
如何解决这些问题?

桥梁浇筑:

ballBody->SetUserData((__bridge void*)self);
enemyBody->SetUserData((__bridge void*)enemySprite);
反之亦然:

CCPhysicsSprite* enemySprite = (__bridge CCPhysicsSprite*)enemyBody->GetUserData();