【发布时间】:2012-02-23 22:25:30
【问题描述】:
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];行。
任何帮助都会很棒,谢谢
【问题讨论】:
-
这种情况下的错误告诉你,这里的 self 不管它可能是什么都没有实现 updateWithEvent。在这种情况下 self 是什么,它应该实现 updateWithEvent 吗?
-
我认为这与 ARC 无关。正如其他人所说,您只是在某处缺少方法声明。
标签: ios xcode4.2 automatic-ref-counting