我在 cocos2dv3 中的项目正在抛出ARC语义问题发现多个名为“setRotation:”的方法,其结果、参数类型或属性不匹配
归档时(发布模式)。它在部署到模拟器/设备(调试模式)时运行良好。
在发布模式下,编译器会混淆旋转的实现UIRotationGestureRecognizer
and CCNode
。
当我收到错误时CCBAnimationManager.m
,我将调用选择器的对象进行类型转换,将 Rotation 设置为 (CCNode
*)但随后错误出现了CCActionInterval
。我希望有一个比 cocos2d 库中到处打字更好的解决方案。
我究竟做错了什么?
感谢您的时间。
EDIT
@interface CCAction : NSObject <NSCopying> {
id __unsafe_unretained _originalTarget;
id __unsafe_unretained _target;
NSInteger _tag;
}
@property (nonatomic,readonly,unsafe_unretained) id target;
@property (nonatomic,readonly,unsafe_unretained) id originalTarget;
@property (nonatomic,readwrite,assign) NSInteger tag;
in
CCAction.m
@synthesize tag = _tag, target = _target, originalTarget = _originalTarget;
-(void) startWithTarget:(id)aTarget
{
_originalTarget = _target = aTarget;
}
-(void) startWithTarget:(id)aTarget
{
_originalTarget = _target = aTarget;
}
类层次结构
@interface CCActionFiniteTime : CCAction <NSCopying>
@interface CCActionInterval: CCActionFiniteTime <NSCopying>
@interface CCBRotateTo : CCActionInterval <NSCopying>
CCBRotateTo.m {
-(void) startWithTarget:(CCNode *)aTarget
{
[super startWithTarget:aTarget];
startAngle_ = [self.target rotation];
diffAngle_ = dstAngle_ - startAngle_;
}
-(void) update: (CCTime) t
{
[self.target setRotation: startAngle_ + diffAngle_ * t];
}
}
这个问题让我很头疼。虽然我已经将旧项目的 cocos2d 升级到 v2.2 版本(太复杂,无法更新到 v3),但我仍然收到此警告。我在 SpriteBuilder 中使用旋转创建的任何动画确实表现得很奇怪,正如我在此处所描述的:cocos2d 2.0 iPhone5S 上的旋转动画问题
最后我在 CCBAnimationManager.m 中使用类型转换来解决它,如下所示
@implementation CCBRotateTo
-(void)startWithTarget:(CCNode *)aTarget
{
[super startWithTarget:aTarget];
starAngle_ = [(CCNode *)self.target rotation];
diffAngle_ = dstAngle_ - startAngle_;
}
-(void)update:(ccTime)t
{
[(CCNode *)self.target setRotation: startAngle_ + diffAngle_ * t];
}
通过这个更改,现在我也可以支持arm64了。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)