[英]objective-c invalid operands to binary expression double to double
[英]Objective-C - Invalid operands to Binary Expression ('double') to ('double *')
我將跟着一個教程學習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
是原始類型,而不是類類型。 您不需要指針。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.