为什么拖动MapView.Marker后应用会崩溃?

时间:2017-03-06 13:59:01

标签: javascript ios react-native android-mapview marker

我的应用中有来自MapView的{​​{1}}的组件。在MapView中,我有一个可拖动的react-native-maps@0.12.2。 问题是有时当我拖动此标记应用程序突然崩溃时出现异常。是的,有时候,这就是奇怪的事情。

MapView.Marker

我真的不知道是什么导致这种情况,代码是根据官方的例子:

Terminating app due to uncaught exception 'NSRangeException', reason:'Cannot remove an observer <AIRMapManager 0x6080000096b0> for the key path "center" from <AIRMapMarker 0x7fdb4a68f4f0> because it is not registered as an observer.'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010c9e0b2b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x000000010b89b281 objc_exception_throw + 48
    2   CoreFoundation                      0x000000010ca49685 +[NSException raise:format:] + 197
    3   Foundation                          0x000000010b3b8a38 -[NSObject(NSKeyValueObserverRegistration) _removeObserver:forProperty:] + 497
    4   Foundation                          0x000000010b3b87ec -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:] + 84
    5   mojazastavka_ios                    0x000000010aed6949 -[AIRMapManager mapView:annotationView:didChangeDragState:fromOldState:] + 1321
    6   MapKit                              0x000000010e66dd9a -[MKMapView _annotationViewDragStateChanged:] + 440
    7   CoreFoundation                      0x000000010c97fc2c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
    8   CoreFoundation                      0x000000010c97fb29 _CFXRegistrationPost + 425
    9   CoreFoundation                      0x000000010c97f892 ___CFXNotificationPost_block_invoke + 50
    10  CoreFoundation                      0x000000010c943132 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1826
    11  CoreFoundation                      0x000000010c942291 _CFXNotificationPost + 673
    12  Foundation                          0x000000010b367328 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
    13  MapKit                              0x000000010e73f916 -[MKAnnotationView setDragState:animated:] + 224
    14  MapKit                              0x000000010e7ebb4f -[MKAnnotationContainerView _dropDraggingAnnotationViewAnimated:] + 276
    15  MapKit                              0x000000010e66b928 -[MKMapView _dropDraggingAnnotationView:] + 91
    16  MapKit                              0x000000010e66bbac -[MKMapView handleLongPress:] + 604
    17  UIKit                               0x000000010f553751 -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] + 57
    18  UIKit                               0x000000010f55b54f _UIGestureRecognizerSendTargetActions + 109
    19  UIKit                               0x000000010f558f03 _UIGestureRecognizerSendActions + 225
    20  UIKit                               0x000000010f5581c6 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 981
    21  UIKit                               0x000000010f544728 _UIGestureEnvironmentUpdate + 1219
    22  UIKit                               0x000000010f544219 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 484
    23  UIKit                               0x000000010f5433e0 -[UIGestureEnvironment _updateGesturesForEvent:window:] + 274
    24  UIKit                               0x000000010f092baa -[UIWindow sendEvent:] + 4092
    25  UIKit                               0x000000010f03f274 -[UIApplication sendEvent:] + 352
    26  UIKit                               0x000000010f81efa8 __dispatchPreprocessedEventFromEventQueue + 2932
    27  UIKit                               0x000000010f816f74 __handleEventQueue + 1115
    28  CoreFoundation                      0x000000010c986c01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    29  CoreFoundation                      0x000000010c96c0af __CFRunLoopDoSources0 + 527
    30  CoreFoundation                      0x000000010c96b5df __CFRunLoopRun + 911
    31  CoreFoundation                      0x000000010c96aff6 CFRunLoopRunSpecific + 406
    32  GraphicsServices                    0x0000000112905979 GSEventRunModal + 62
    33  UIKit                               0x000000010f021bb1 UIApplicationMain + 159
    34  mojazastavka_ios                    0x000000010aecd67f main + 111
    35  libdyld.dylib                       0x00000001109fc66d start + 1
    36  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

1 个答案:

答案 0 :(得分:0)

通过从模拟器中删除应用并重建项目来

解决。原始解决方案here

相关问题