开发者

iPhone SDK / iOS crash in webview / scrollview?

开发者 https://www.devze.com 2023-02-20 01:24 出处:网络
I\'m having really strange crash in my application. It occurs randomly. Basically, I\'m having large scroll view containing multiple UIWebViews, which I\'m loading from HTML string. After some time, f

I'm having really strange crash in my application. It occurs randomly. Basically, I'm having large scroll view containing multiple UIWebViews, which I'm loading from HTML string. After some time, following crash appears:

*** 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 __CFRunLoopR开发者_如何学Pythonun + 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'

I really can not resolve this, because crashes are random and seem to be in CoreFoundation, which I do not controll directly. Any suggestion?

Thank you very much for any help!


Not really an answer to your issue, but: be aware that Apple recommend against putting UIWebViews inside UIScrollViews. It's certainly possible to do, in my experience, but just be warned that wacky things might happen.

Related question: Two resizable UIWebViews inside UIScrollView


The problem is in your gesture recognizers. The UIView is attempting to remove a recognizer that is presumably not there. It accesses index 7 of the 6 element array causing the crash.

I would check any customizations of the gestures you might have done.

0

精彩评论

暂无评论...
验证码 换一张
取 消