我的应用程序中发生了非常奇怪的崩溃。它是随机发生的。基本上,我有一个包含多个UIWebViews的大型滚动 View ,该 View 是从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中,我无法直接控制崩溃。有什么建议吗?

非常感谢您的帮助!

最佳答案

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

相关问题:
Two resizable UIWebViews inside UIScrollView

09-09 23:43
查看更多