我的应用程序中发生了一次奇怪的崩溃 首先,我会让你看一眼应用程序,有一个包含许多注释的地图,我也将这些注释的标注自定义为包含按钮和许多信息的视图,它包含一个具有动作的按钮要转到应用程序中的另一个选项卡,它被称为DisclosureButton
我在项目中添加了断点异常,因此我得到了应用程序崩溃的位置,您可以在第173行看到它 正如您在上面的控制台中看到的那样,view.annotation为null,因此在某些时候删除了注释。在检查线程1执行的操作(主线程,您可以在下面看到)之后,我看到在从地图中删除注释时,执行了公开按钮操作。为什么主线程停止执行updateMap方法并启动公开按钮的操作?这是控制台首先显示的“删除注释之前”然后在revealButton的操作中的日志而不记录“在创建注释之前”,这是非常奇怪的,我不知道此时发生了什么?
我不确定发生了什么,任何建议/意见/协助都会受到赞赏
提前致谢,
答案 0 :(得分:1)
iOS 6喜欢在地图中播放注释,因为谁知道原因。我的解决方案是只保留拥有类中的注释,并处理内存。它现在正在工作,但它不会让原生mapKit处理它...不确定是否有我应该观看的新WWDC视频或添加到MKMap编程文档的页面,但是现在这个工作。
答案 1 :(得分:0)
我想我遇到了同样的问题。我的后台主题是添加/删除注释,但注释上的按钮将添加到主线程中。这也意味着主线程对注释进行了枚举(出于某种原因)。我通过在主线程中添加来修复它。
仅在iOS 6上存在问题。
我不确定你的例外是什么,但我的是:
* 集合< __ NSArrayM:0x136d57c0>在被列举时被突变。
0 CoreFoundation 0x0330e02e __exceptionPreprocess + 206
1 libobjc.A.dylib 0x02735e7e objc_exception_throw + 44
2 CoreFoundation 0x03396cc5 __NSFastEnumerationMutationHandler + 165
3 MapKit 0x0231748c -[MKAnnotationContainerView _updateAnnotationViewPerspective] + 399
4 MapKit 0x02305520 -[MKMapView _updateScrollContainerView:] + 2478
5 MapKit 0x02303e10 -[MKMapView _didChangeRegionMidstream:] + 97
6 MapKit 0x02305d66 -[MKMapView _goToMapRegion:duration:animationType:] + 828
7 MapKit 0x023061bd -[MKMapView _setZoomScale:centerMapPoint:duration:animationType:] + 711
8 MapKit 0x02305a24 -[MKMapView _setZoomScale:centerCoordinate:duration:animationType:] + 121
9 MapKit 0x02307f8f -[MKMapView _goToCenterCoordinate:zoomLevel:animationType:cancelDefaultLocationTimer:] + 950
10 MapKit 0x023075fb -[MKMapView goToCenterCoordinate:zoomLevel:animationType:] + 81
11 MapKit 0x023076c9 -[MKMapView goToCenterCoordinate:longLatSpan:animationType:] + 178
12 MapKit 0x0230992a -[MKMapView goToDefaultLocation] + 415
13 Foundation 0x009a0b90 __NSFireTimer + 97
14 CoreFoundation 0x032cd376 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
15 CoreFoundation 0x032cce06 __CFRunLoopDoTimer + 534
16 CoreFoundation 0x032b4a82 __CFRunLoopRun + 1810
17 CoreFoundation 0x032b3f44 CFRunLoopRunSpecific + 276
18 CoreFoundation 0x032b3e1b CFRunLoopRunInMode + 123
19 GraphicsServices 0x03c557e3 GSEventRunModal + 88
20 GraphicsServices 0x03c55668 GSEventRun + 104
21 UIKit 0x00d3465c UIApplicationMain + 1211
22 myApp 0x00002c93 myApp + 7315
23 myApp 0x00002bd5 myApp + 7125