如何消除方法实现中未使用参数的警告
使用 AppCode 108.1068,使用 cocos2d 开发 iOS 应用程序,我经常最终实现选择器的方法,事情是这样的:
-(void) sequenceStateSelectSkillByCPU:(ccTime) dt{
if (cycleCount_==1) {
touchHandler_.isEnabled=NO;
isSequencingSkillsChoice_=YES;
[self interruptScheduling];
[self flyOut];
[master_ taskComplete:@"skillsChoice"];
}
}
我不断收到有关未使用变量的警告(dt,我知道,我更喜欢完全控制我的状态处理而不是依赖 dt)。我正在实现一种符合协议的方法,无论我是否需要,在所有情况下都会将 dt 强加给我。
想知道在哪里/如何静音该特定警告。
Using AppCode 108.1068, developing an iOS app with cocos2d, I often end up implementing methods for a selector, and it goes like this:
-(void) sequenceStateSelectSkillByCPU:(ccTime) dt{
if (cycleCount_==1) {
touchHandler_.isEnabled=NO;
isSequencingSkillsChoice_=YES;
[self interruptScheduling];
[self flyOut];
[master_ taskComplete:@"skillsChoice"];
}
}
I keep getting the warning about unused variable (dt, i Know, i prefer having full control over my state handling rather than relying on dt). I am implementing a method that complies to a protocol that shoves dt on me, in all circumstances, whether i need it or not.
Was wondering where/how to mute that specific warning.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
事实证明,要检查的检查是“未使用的局部变量”...不幸的是,这也停止了方法体内声明的变量的有用的“未使用的局部变量”。
Turns out the inspection to check off is 'unused local variables' ... which unfortunately also stops the useful 'unused local variables'for variables declared inside the body of the method.
隐藏编译器警告不是一个好习惯。但有时在来自其他框架或内置项目的大量警告中找出我的警告确实很复杂。无论如何,如果有人想要抑制那些“未使用的”编译器警告,请打开项目的构建设置并更改编译标志。
It is not good practice to hide compiler warnings. But sometimes it's really complicated to find out my warnigs among huge number of warnings from other frameworks or built-in projects. Anyway if any one want to supress those "unused" compliler warnigs then open project's build settings and change the compilation flags.