错误:预期':'''''令牌

时间:2011-05-13 13:02:55

标签: objective-c

-(void)countdown:(NSTimer *)timer{

    _value -=1;
    if ((_delegate != nil) && [_delegate respondsToSelector:@selector(countdownTicker:didUpdateValue:withAction)]) { // error: expected ':' before ')' token
        [_delegate countdownTicker:self didUpdateValue:_value withAction:ZIMCountdownTickerTickAction];
    }
    if (_value <= 0) {
        [self stop];
        if ((_delegate != nil) && [_delegate respondsToSelector:@selector(countdownTicker:didUpdateValue:withAction)]) { // error: expected ':' before ')' token
            [_delegate countdownTickerDidFinish:self];
        }
    }
}

2 个答案:

答案 0 :(得分:4)

完全按错误说明修复:

... respondsToSelector:@selector(countdownTicker:didUpdateValue:withAction:)]
                                                                          ^

答案 1 :(得分:2)

您需要在选择器中withAction参数的末尾加上“:”。