无法识别的select器被调用
在我的应用程序中,我使用注释显示地图,用户可以在表格视图(模式视图控制器)中浏览注释列表。
我遇到了一个奇怪的错误,我可以在设备和模拟器(iOS 7和8)上重现。
在倾斜模式下,如果我尝试在POI表格视图中select一个项目,它将执行以下操作之一:
- 将地图中心更改为地图上的随机点,而不是选定的注释。
- 崩溃与我放在消息(NSZombies启用)。
– [__ NSCFString isPitched]:无法识别的select器发送到实例0x7f24e6e0
我尝试了几种方法来解决这个错误,但没有成功。 而令我感到困惑的是,我无法在isPitched方法上find任何信息。 这不是在我的代码中,也不在苹果文档中。
有人知道更多关于MapKit和这些types的问题? 另外,当用户在列表中select一个POI时,你是否知道一种停用音高的方法? 也许它会阻止错误。
编辑:只是发现'isPitched'方法实际上是VectorKit的一部分! 虽然没有真正的帮助。 没有关于VectorKit的文档…
编辑2:添加堆栈跟踪。
- [__ NSCFString isPitched]:无法识别的select器发送到实例0x7db84870 2015-02-28 14:25:08.501 Cartel 2015 [2481:178443] ***终止应用程序由于未捕获的exception“NSInvalidArgumentException”,原因:' - [__ NSCFString isPitched]:无法识别的select器发送到实例0x7db84870' ***第一个投掷堆栈: ( 0 CoreFoundation 0x00afb946 __exceptionPreprocess + 182 1 libobjc.A.dylib 0x00784a97 objc_exception_throw + 44 2 CoreFoundation 0x00b035c5 - [NSObject(NSObject)doesNotRecognizeSelector:] + 277 3 CoreFoundation 0x00a4c3e7 ___forwarding___ + 1047 4 CoreFoundation 0x00a4bfae _CF_forwarding_prep_0 + 14 5 VectorKit 0x02dd09c1 __86- [VKMapCameraController _animateToPosition:pitch:yaw:duration:timingCurve:completion:] _ block_invoke + 1809 6 VectorKit 0x02d88645 - [VKanimationonTimerFired:] + 357 7 VectorKit 0x02d9895e - [VKScreenCanvas animateWithTimestamp:] + 686 8 VectorKit 0x02d9850e - [VKScreenCanvas updateWithTimestamp:] + 46 9 VectorKit 0x02d71e69 - [VKMapView onTimerFired:] + 89 10 libobjc.A.dylib 0x0079a771 - [NSObject performSelector:withObject:] + 70 11 VectorKit 0x0323463c - [GGLDisplayLink _displayLinkFired:] + 60 12 QuartzCore 0x041abcad _ZN2CA7Display15DisplayLinkItem8dispatchEv + 45 13 QuartzCore 0x041abb83 _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 311 14 QuartzCore 0x041ac067 _ZN2CA7Display16TimerDisplayLink8callbackEP16__CFRunLoopTimerPv + 123 15 CoreFoundation 0x00a558d6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22 16 CoreFoundation 0x00a5525d __CFRunLoopDoTimer + 1309 17 CoreFoundation 0x00a146ba __CFRunLoopRun + 2090 18 CoreFoundation 0x00a13bcb CFRunLoopRunSpecific + 443 19 CoreFoundation 0x00a139fb CFRunLoopRunInMode + 123 20 GraphicsServices 0x03f4324f GSEventRunModal + 192 21 GraphicsServices 0x03f4308c GSEventRun + 104 22 UIKit 0x00f318b6 UIApplicationMain + 1526 23卡特尔2015 0x0001110d主+ 141 24 libdyld.dylib 0x046aaac9 start + 1 25 0x00000001 0x0 + 1
好吧,我设法防止与下面的修复程序的崩溃。
当我的列表中select一个兴趣点,我触发一个视图控制器的委托方法,从tableView控制器的didSelect方法处理MapView。 如果你有同样的问题,我想你明白我的意思,到目前为止。
在这个方法中,我要求MapView将自己置于POI的坐标上。
现在,要解决只有当用户跟踪模式设置为“pitched”(跟随您的方向)时才会发生的问题,我只是在我的方法开始处添加了一条线以禁用此跟踪模式:
[mapView setUserTrackingMode: MKUserTrackingModeNone] ;
这消除了随机出现的崩溃。 请注意,它不会导致违反直觉的行为,因为当用户移动地图时,此跟踪模式会自动停用。
所以问题解决了我,但如果你有任何关于这个ispitchedselect器的信息是什么真的造成这个问题,你非常欢迎在这里发表!