unrecognized selector isPitched called

北城以北 提交于 2019-12-24 05:01:14

问题


In my app, I am displaying a map with annotations, and the user can browse the list of annotations in a table view (in a modal view controller).

I am experiencing a weird bug that I can reproduce both on device and in the simulator (iOS 7 & 8).

When in pitched mode, if I try to select an item in my POI table view, it does one of these :

  • changes the map center to a random point on the map, not the selected annotation.
  • crashes with the message that I put under (NSZombies enabled).

-[__NSCFString isPitched]: unrecognized selector sent to instance 0x7f24e6e0

I tried several methods to solve this bug, but with no success. And what puzzles me is I can't find any information on the isPitched method. It isn't in my code, neither in Apple documentation.

Does someone knows more on MapKit and these types of problem ? Alternatively, would you know a way to deactivate the pitch when a user select a POI in the list ? Maybe it would prevent the bug.

EDIT : Just found that the 'isPitched' method is actually part of VectorKit ! Doesn't really help, though. No documentation on VectorKit...

EDIT 2 : Added stack trace.

-[__NSCFString isPitched]: unrecognized selector sent to instance 0x7db84870
2015-02-28 14:25:08.501 Cartel 2015[2481:178443] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString isPitched]: unrecognized selector sent to instance 0x7db84870'
*** First throw call stack:
(
    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 -[VKAnimation onTimerFired:] + 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  Cartel 2015                         0x0001110d main + 141
    24  libdyld.dylib                       0x046aaac9 start + 1
    25  ???                                 0x00000001 0x0 + 1

回答1:


OK, I managed to prevent the crash with the following fix.

When a POI is selected in my list, I trigger a delegate method of the view controller that handles the MapView from the didSelect method of the controller of the tableView. If you have the same problem, I assume you understand what I mean, so far.

In this method, I asked the MapView to center itself on the coordinates of the POI.

Now, to solve the problem that only happened when the user tracking mode was set to "pitched" (following your orientation), I simply added a line to deactivate this tracking mode at the beginning of my method :

[mapView setUserTrackingMode: MKUserTrackingModeNone] ;

This removed the crashes that randomly appeared. Notice that it doesn't result in a counterintuitive behavior because this tracking mode is automatically deactivated when the user moves the map.

So problem solved for me but if you have any information about this isPitched selector and what really caused the problem, you're very welcome to post it here !



来源:https://stackoverflow.com/questions/28782161/unrecognized-selector-ispitched-called

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!