Xcode 4.2错误:实例消息的接收器类型没有声明带选择器的方法

时间:2012-02-23 22:25:30

标签: ios xcode4.2 automatic-ref-counting

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 个答案:

答案 0 :(得分:1)

  1. 检查您是否在FirstViewController
  2. 中有方法 updateWithEvent
  3. 将它放在LocationManager委托方法之前,或在头文件中定义此方法。