0

我的应用程序发生了非常奇怪的崩溃。它随机发生。基本上,我有一个包含多个 UIWebViews 的大型滚动视图,我是从 HTML 字符串加载的。一段时间后,出现以下崩溃:

*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray objectAtIndex:]: index 7 beyond bounds [0 .. 6]'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x0110dbe9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x00f025c2 objc_exception_throw + 47
    2   CoreFoundation                      0x011036e5 -[__NSArrayM objectAtIndex:] + 261
    3   CoreFoundation                      0x010866e5 -[NSMutableArray removeObject:range:identical:] + 437
    4   CoreFoundation                      0x01086520 -[NSMutableArray removeObject:] + 96
    5   UIKit                               0x0035e7c0 -[UIView(UIViewGestures) removeGestureRecognizer:] + 112
    6   UIKit                               0x005f85c1 -[UIWebSelectionAssistant setGestureRecognizers] + 58
    7   UIKit                               0x004b0d09 -[UIWebDocumentView loadHTMLString:baseURL:] + 286
    8   CoreFoundation                      0x0107e67d __invoking___ + 29
    9   CoreFoundation                      0x0107e551 -[NSInvocation invoke] + 145
    10  WebCore                             0x0217f3c3 _ZL15HandleAPISourcePv + 147
    11  CoreFoundation                      0x010ef01f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
    12  CoreFoundation                      0x0104d28b __CFRunLoopDoSources0 + 571
    13  CoreFoundation                      0x0104c786 __CFRunLoopRun + 470
    14  CoreFoundation                      0x0104c240 CFRunLoopRunSpecific + 208
    15  CoreFoundation                      0x0104c161 CFRunLoopRunInMode + 97
    16  WebCore                             0x02240423 _ZL12RunWebThreadPv + 499
    17  libSystem.B.dylib                   0x901ea85d _pthread_start + 345
    18  libSystem.B.dylib                   0x901ea6e2 thread_start + 34
)
terminate called after throwing an instance of 'NSException'

我真的无法解决这个问题,因为崩溃是随机的,而且似乎在 CoreFoundation 中,我无法直接控制它。有什么建议吗?

非常感谢您的帮助!

4

2 回答 2

1

不是您的问题的真正答案,但是:请注意,Apple 建议不要将 UIWebViews 放在 UIScrollViews 中。根据我的经验,这当然是可能的,但请注意可能会发生古怪的事情。

相关问题: UIScrollView 中的两个可调整大小的 UIWebViews

于 2011-03-25T20:31:44.457 回答
0

问题在于您的手势识别器。UIView 正在尝试删除可能不存在的识别器。它访问导致崩溃的 6 元素数组的索引 7。

我会检查你可能做过的手势的任何自定义。

于 2011-03-25T20:32:08.453 回答