我现在有一个应用程序可以在 map 上显示各种图钉。我已经尝试设置 mapView.showsUserLocation = YES;
来显示用户的当前位置,但是这使我的应用程序崩溃(“程序收到信号:SIGABRT”)并显示以下错误消息:
Mon Oct 19 12:31:27 unknown Hull Ads[3111] <Error>: *** -[MKUserLocation counter]: unrecognized selector sent to instance 0x10ad60
Mon Oct 19 12:31:27 unknown Hull Ads[3111] <Error>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[MKUserLocation counter]: unrecognized selector sent to instance 0x10ad60'
Mon Oct 19 12:31:27 unknown Hull Ads[3111] <Error>: Stack: (...)
这有点令人困惑,因为我没有使用过 MKUserLocation,或者这就是问题所在?
该应用程序确实将 CoreLocation 用于其他不相关的目的,但是当 CoreLocation 尚未被使用时,该应用程序以相同的方式响应。
如果有人能提供帮助那就太棒了!
谢谢 - 詹姆斯
最佳答案
确保在此方法中包含以下内容:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
if ([annotation class] == MKUserLocation.class) {
return nil;
}
...
}
我希望你现在已经解决了这个问题;)
关于objective-c - 使用 MKMapView 的 showUserLocation 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1588202/