Xcode在YES
之前期待')' [_creep scheduleOnce:@selector(removeFromParentAndCleanup:YES) delay:2.0f];
对不起,如果它看起来很基本......我刚刚开始了ObjectiveC。
答案 0 :(得分:2)
因为Cocos API将您限制为一个带有1个参数的选择器(ccTime),所以编写自己的方法将给定的参数传递给正确的函数:
-(void)doneWithSomething {
[self scheduleOnce:@selector(removeAndCleanup:) delay:2.0f];
}
-(void)removeAndCleanup:(ccTime)delta {
[ _creep removeFromParentAndCleanup:YES];
}
你不能在@selector()
指令中传递参数,因为它直接与vTable中的条目(对于常用方法)或ObjC sel缓存中的条目相关联,因此编译器认为您正在尝试调用一种名为-removeFromParentAndCleanup:YES