我正在尝试实现以下方法以在我的 map 的可见区域中选择一组注释。
- (NSSet *)annotationsInMapRect:(MKMapRect)mapRect
我在我的代码中添加了这一行
NSSet *nearbySet = [self annotationsInMapRect:self.mapView.frame];
我的应用因此而崩溃。谁能建议我应该如何正确使用上述方法?
编辑: Stack Trace如下:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CarParkTableViewController annotationsInMapRect:]: unrecognized selector sent to instance 0x187b60'
谢谢
郑和
最佳答案
尝试
NSSet *nearbySet = [self.mapView annotationsInMapRect:self.mapView.frame];
您发布的错误表明 self 不是 MKMapView 的实例,但 annotationsInMapRect 是您只能发送到该类的消息。
关于objective-c - Objective-C : How to implement MapKit Method - (NSSet *)annotationsInMapRect:(MKMapRect)mapRect,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5921578/