5

我在使用 MKMapView 的 iOS 模拟器中得到了似乎随机发生的崩溃。它不是由任何用户操作触发的,它只是无中生有。我得到以下堆栈跟踪:

<_NSCallStackArray 0x2d9762b0>(
0   ???                                 0x137d69bd 0x0 + 326986173,
1   Foundation                          0x03ca3b0a -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 282,
2   Foundation                          0x03c10b61 _NSGetUsingKeyValueGetter + 81,
3   Foundation                          0x03c1019b -[NSObject(NSKeyValueCoding) valueForKey:] + 260,
4   AccessibilityUtilities              0x11ad1a3f -[NSObject(UIAccessibilitySafeCategory) safeValueForKey:] + 43,
5   MapKitFramework                     0x12090aa4 -[MKBasicMapViewAccessibility(SafeCategory) accessibilityContainerElements] + 91,
6   UIAccessibility                     0x11fc7149 -[NSObject(AXPrivCategory) accessibilityElementCount] + 34,
7   UIAccessibility                     0x11fc751f -[NSObject(AXPrivCategory) _accessibilityHasOrderedChildren] + 59,
8   UIKit                               0x11ebb388 -[UIViewAccessibility(SafeCategory) _accessibilitySubviewsForGettingElementsIncludingContainers:includingOpaqueElementProviders:] + 2269,
9   UIKit                               0x11ebba96 -[UIViewAccessibility(SafeCategory) _accessibilityElementsInContainer:topLevel:includeKB:includeOpaqueElementProviders:] + 486,
10  UIKit                               0x11eba12f -[UIViewAccessibility(SafeCategory) _accessibilityElementsInContainer:topLevel:includeKB:] + 64,
11  UIKit                               0x11eba0ea -[UIViewAccessibility(SafeCategory) _accessibilityElementsInContainer:] + 57,
12  UIKit                               0x11e9b097 -[UIApplicationAccessibility(SafeCategory) _accessibilityElementFirst:last:forFocus:] + 88,
13  UIKit                               0x11e9b936 -[UIApplicationAccessibility(SafeCategory) _accessibilityFirstElement] + 57,
14  UIKit                               0x11e9ea63 -[UIApplicationAccessibility(SafeCategory) accessibilityAttributeValue:] + 333,
15  UIAccessibility                     0x11fbe3b9 _copyAttributeValueCallback + 151,
16  AXRuntime                           0x1201f431 _AXXMIGCopyAttributeValue + 139,
17  AXRuntime                           0x1201a300 _XCopyAttributeValue + 322,
18  AXRuntime                           0x120256c8 mshMIGPerform + 256,
19  CoreFoundation                      0x0447bdd5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53,
20  CoreFoundation                      0x0447bb0b __CFRunLoopDoSource1 + 523,
21  CoreFoundation                      0x044a67ec __CFRunLoopRun + 2156,
22  CoreFoundation                      0x044a5b33 CFRunLoopRunSpecific + 467,
23  CoreFoundation                      0x044a594b CFRunLoopRunInMode + 123,
24  GraphicsServices                    0x04f849d7 GSEventRunModal + 192,
25  GraphicsServices                    0x04f847fe GSEventRun + 104,
26  UIKit                               0x010d294b UIApplicationMain + 1225,
27  Twinkie                             0x000035d4 main + 228,
28  libdyld.dylib                       0x04a3f725 start + 0

当我检查寄存器时,我看到以下内容:

{
    NSTargetObjectUserInfoKey = "<UIView: 0x123dd690; frame = (0 0; 320 568); autoresizesSubviews = NO; gestureRecognizers = <NSArray: 0x253f0270>; layer = <CALayer: 0x123dd6f0>>";
    NSUnknownUserInfoKey = "_annotationContainer";
}

0x123dd690是 的子视图MKMapView,正如您在 MKMapview 上进行递归描述时所见:

<MKMapView: 0x123dd080; frame = (0 0; 320 568); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x1d89c840>; layer = <CALayer: 0x123dd1f0>>
   | <UIView: 0x123dd690; frame = (0 0; 320 568); autoresizesSubviews = NO; gestureRecognizers = <NSArray: 0x253f0270>; layer = <CALayer: 0x123dd6f0>>
   |    | <MKBasicMapView: 0x123dd720; frame = (0 0; 320 568); clipsToBounds = YES; layer = <CALayer: 0x123dd850>>
   |    |    | <_MKMapLayerHostingView: 0x123dd7a0; frame = (0 0; 320 568); layer = <_MKMapLayerHostingLayer: 0x123ddb00>>
   |    |    |    | <VKMapView: 0x123ddf40> (layer)
   |    |    |    |    | <VKMapCanvas: 0x18826ab0> (layer)
   |    |    |    |    |    | <VGLLayer: 0x18824510> (layer)
   |    | <MKScrollContainerView: 0x253499e0; frame = (-407522 -982166; 2.5318e+06 2.5318e+06); autoresizesSubviews = NO; layer = <CALayer: 0x2534d0e0>>
   |    |    | <MKOverlayContainerView: 0x1d8cdef0; frame = (0 0; 2.5318e+06 2.5318e+06); transform = [0.0094316732, 0, 0, 0.0094316732, 0, 0]; layer = <CALayer: 0x1d8cdfc0>> 
etc...

任何指针如何解决这个问题?为什么要尝试做可访问性的东西?

4

2 回答 2

2

我现在通过执行以下操作来修复它:

#if TARGET_IPHONE_SIMULATOR

@interface UIView (FixIt) @end

@implementation UIView (FixIt)

- (id)_annotationContainer
{
    return nil;
}

@end

#endif
于 2013-11-14T13:50:13.637 回答
1

我今天遇到了这个问题,并在http://www.openradar.me/15429762提交了它。

事实证明,这只是模拟器中的一个问题——如果你在设备上构建它就不会出现。所以……不用担心?希望 Apple 能尽快解决这个问题,但现在,您可以通过在设备上构建来解决它。

于 2013-11-09T00:47:14.940 回答