ios - 当尝试删除基于 iOS 6.1 的所有 MKAnnotations 时,MapKit 上会随机崩溃。

标签 ios crash mapkit mkannotationview

使用基于iOS6.1的MapKit,当我尝试删除所有MKAnnotations然后弹出 map View Controller 时,应用程序会随机崩溃(发生率非常低)。从崩溃日志来看,这似乎是一个观察者问题,任何经历过类似问题的人请给我一些见解,任何想法或讨论将不胜感激。提前致谢。

附注:

UIMapView 是我的应用程序中的单例,仅创建一次。

2013-08-13 15:11:59.025 CHSP[9129:c07] CRASH: Cannot remove an observer <MKAnnotationContainerView 0xb8e5120> for the key path "title" from <MKUserLocation 0xbab3440> because it is not registered as an observer.

2013-08-13 15:11:59.060 CHSP[9129:c07] Stack Trace: (
    0   CoreFoundation                      0x028ff02e __exceptionPreprocess + 206
1   libobjc.A.dylib                     0x02030e7e objc_exception_throw + 44
2   CoreFoundation                      0x028fedeb +[NSException raise:format:] + 139
3   Foundation                          0x01a84a89 -[NSObject(NSKeyValueObserverRegistration) _removeObserver:forProperty:] + 790
4   Foundation                          0x01a8471d -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:] + 105
5   MapKit                              0x009194f9 -[MKAnnotationContainerView _unregisterObserverForBubbleAnnotation:] + 116
6   MapKit                              0x00919704 -[MKAnnotationContainerView setBubbleAnnotationView:] + 99
7   MapKit                              0x0091925d -[MKAnnotationContainerView _removeBubbleWithAnimation:tellDelegate:] + 247
8   MapKit                              0x0091b114 -[MKAnnotationContainerView _deselectAnnotationViewWithAnimation:tellDelegate:] + 128
9   MapKit                              0x0091b1e1 -[MKAnnotationContainerView _deselectAnnotationView] + 49
10  MapKit                              0x0092198e -[MKAnnotationContainerView _removeAnnotationView:updateCollections:] + 395
11  MapKit                              0x009217fe -[MKAnnotationContainerView _removeAnnotationView:] + 48
12  MapKit                              0x00921490 -[MKAnnotationContainerView removeAnnotation:] + 375
13  MapKit                              0x00921538 -[MKAnnotationContainerView removeAnnotations:] + 160
14  MapKit                              0x0090f8bd -[MKMapView removeAnnotations:] + 58
15  CHSP                                0x00077fd5 -[UPNewMapViewController removeAllAnnotations] + 101
16  CHSP                                0x00076640 -[UPNewMapViewController dealloc] + 64
17  UIKit                               0x01055480 -[UIViewController release] + 93
18  libobjc.A.dylib                     0x020430c3 objc_release + 51
19  libobjc.A.dylib                     0x02043bd9 _ZN12_GLOBAL__N_119AutoreleasePoolPage3popEPv + 555
20  CoreFoundation                      0x028a1468 _CFAutoreleasePoolPop + 24
21  CoreFoundation                      0x028a5afd __CFRunLoopRun + 1933
22  CoreFoundation                      0x028a4f44 CFRunLoopRunSpecific + 276
23  CoreFoundation                      0x028a4e1b CFRunLoopRunInMode + 123
24  GraphicsServices                    0x02c927e3 GSEventRunModal + 88
25  GraphicsServices                    0x02c92668 GSEventRun + 104
26  UIKit                               0x00f7753c UIApplicationMain + 1211
27  CHSP                                0x0009d9a2 main + 130
28  CHSP                                0x00002f55 start + 53
)

2013-08-13 15:11:59.061 CHSP[9129:c07] *** Terminating app due to uncaught exception 'NSRangeException', reason: 'Cannot remove an observer <MKAnnotationContainerView 0xb8e5120> for the key path "title" from <MKUserLocation 0xbab3440> because it is not registered as an observer.'

最佳答案

我自己修好了。 最初我尝试使用另一张图像来显示用户当前位置而不是 Mapkit 默认图像,似乎这不是一个好主意。

关于ios - 当尝试删除基于 iOS 6.1 的所有 MKAnnotations 时,MapKit 上会随机崩溃。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18244414/

相关文章:

ios - 代码 : Text Field to String

iphone - 从我的 ip4 设备的崩溃日志中找到崩溃代码

ios - iOS崩溃追随者

ios - 向 map 添加多个注释但都显示一些相同的数据

swift - iOS 11 不会从 MKMapView 抓取屏幕

ios - 立即编辑一个可编辑的 UIWebView

ios - 重置上下文不会触发 fetchResultedController

ios - 停止调用后从头开始播放AvAudioPlayer文件

c++ - OpenCV 简单代码编译成功但在运行时崩溃

ios - 从 MKMapView 制作 UIImage