我在代码中有以下行:
#define INACTIVITYTIMEBEFOREBAITARROWDISPATCHED 60.0
我在这条线上收到一个错误,上面写着,Too many arguments to method call, expected 1, have 2
我是否超过了最大长度?如果有,最大长度是多少?无论如何,实际的信息似乎很荒谬。
根据请求,这里是上下文:
#define VITALITYSECONDS 40.0
#define MINIMUMSCALEFACTOR 0.10
#define MINIMUMSPEED 2.0
#define INACTIVITYTIMEBEFOREBAITARROWDISPATCHED 60.0
#pragma mark - Angle and Distance Functions
-(float)normalizeAngle:(float)angle
{
float answer;
// Take an angle and return a value from -pi to pi
// To do this, we first add pi, then divide by 2pi, then take fractional part, then multiply by 2pi then subtract pi.
answer = angle + M_PI;
answer = answer/(2*M_PI);
answer = answer - floor(answer);
answer = answer * 2 * M_PI;
answer = answer - M_PI;
return answer;
}
为了完整起见,这是有问题的行:
[self helpText:@"Bait arrow dispatched due to %f seconds inactivity\n",INACTIVITYTIMEBEFOREBAITARROWDISPATCHED];
这是更正的版本:
[self helpText:[NSString stringWithFormat:@"Bait arrow dispatched due to %f seconds inactivity\n",INACTIVITYTIMEBEFOREBAITARROWDISPATCHED]];
这是该方法的声明:
-(void)helpText:(NSString *)text
方法 helpText 只是在屏幕上显示内容以帮助测试人员的临时方法。