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