jjzjj

ios - Xcode 4.2 错误 : receiver type for instance message does not declare a method with selector

coder 2024-01-27 原文

ARC 错误:“实例消息的接收器类型‘FirstViewController’未声明带有选择器‘updateWithEvent’的方法”

我知道这是因为 ARC,在 xcode 4.2 中,但任何人都可以帮助解决这个问题:

- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region      {
    NSString *event = [NSString stringWithFormat:@"didEnterRegion %@ at %@",     region.identifier, [NSDate date]];

    [self updateWithEvent:event];
}


- (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region {
    NSString *event = [NSString stringWithFormat:@"didExitRegion %@ at %@",     region.identifier, [NSDate date]];

    [self updateWithEvent:event];
}


- (void)locationManager:(CLLocationManager *)manager monitoringDidFailForRegion:(CLRegion *)region withError:(NSError *)error {
    NSString *event = [NSString stringWithFormat:@"monitoringDidFailForRegion %@: %@", region.identifier, error];

    [self updateWithEvent:event];
}

错误发生在每个 [self updateWithEvent:event];行。

任何帮助都会很棒,谢谢

最佳答案

  1. 检查 FirstViewController 中是否有方法 updateWithEvent
  2. 将其放在 LocationManager 委托(delegate)方法之前或在头文件中定义此方法。

关于ios - Xcode 4.2 错误 : receiver type for instance message does not declare a method with selector,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9422357/

有关ios - Xcode 4.2 错误 : receiver type for instance message does not declare a method with selector的更多相关文章

随机推荐