我将跟着一个教程学习iOS游戏开发。在视频中,他没有错误,如果缺少方法或我做错了事,请使用idk。我是大学的CS专业学生,并且在Obj-C上过一堂课,而我目前正在iOS7应用程序开发课上。我遇到此错误...
二进制表达式的无效操作数(“ CFTimeInterval”(又名“ double”)和“ NSTimeInterval *”(又名“ double *”))
/* NSTimeInterval *_dt;
NSTimeInterval *_lastUpdateTime;
*/
//The above shows what _dt and _lastUpdateTime are
-(void)update:(CFTimeInterval)currentTime
{
/* Called before each frame is rendered */
if(_lastUpdateTime)
{
_dt = currentTime - _lastUpdateTime; //Line of Error From Title
}
else
{
_dt = 0;
}
_lastUpdateTime = ¤tTime;
[self movePipes];
}
更改这些行:
NSTimeInterval *_dt;
NSTimeInterval *_lastUpdateTime;
到:
NSTimeInterval _dt;
NSTimeInterval _lastUpdateTime;
然后&
在以下行中删除:
_lastUpdateTime = ¤tTime;
NSTimeInterval
是基本类型,而不是类类型。您不需要指针。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句