0

My Application is getting crashed while scrolling UIWebview - I have used ILPDFKit for implementing interactive PDF - Editable Forms.App is getting crashed only if i am adding more than 126 Objects.

Here is code I am using (from ILPDFKit)

for (PDFWidgetAnnotationView *element in widgetAnnotationViews)
{
    element.alpha = 0;
    element.parentView = self;
    [_pdfView.scrollView addSubview:element];
    [_pdfView.scrollView bringSubviewToFront:element];

    if ([element isKindOfClass:[PDFFormButtonField class]])
    {
        [(PDFFormButtonField*)element setButtonSuperview];
    }
}

I have also raise Issue here

I have added some customview's in my webview.scrollview , so while scrolling webview my App is getting crashed. i have checked for all possible solutions i found on google/stackoverflow.

none of the delegate method of scrollview / webview called before this crash , as soon as i tried to scroll and app is getting crashed.

below is crash report.

*** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSArrayM: 0x6000024535f0> was mutated while being enumerated.'
*** First throw call stack:
(
    0   CoreFoundation                      0x00000001045dd34b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x0000000103f5f21e objc_exception_throw + 48
    2   CoreFoundation                      0x0000000104645f1c __NSFastEnumerationMutationHandler + 124
    3   CoreFoundation                      0x0000000104582638 -[NSArray makeObjectsPerformSelector:] + 424
    4   UIKit                               0x00000001020d8f4f -[UIScrollView(UIScrollViewInternal) _notifyDidScroll] + 163
    5   UIKit                               0x00000001020c3919 -[UIScrollView setContentOffset:] + 478
    6   UIKit                               0x00000001020c8351 -[UIScrollView _updatePanGesture] + 2346
    7   UIKit                               0x0000000102531289 -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] + 57
    8   UIKit                               0x0000000102539028 _UIGestureRecognizerSendTargetActions + 109
    9   UIKit                               0x0000000102536af7 _UIGestureRecognizerSendActions + 227
    10  UIKit                               0x0000000102535d83 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 891
    11  UIKit                               0x0000000102521e56 _UIGestureEnvironmentUpdate + 1395
    12  UIKit                               0x000000010252189b -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 521
    13  UIKit                               0x0000000102520a7e -[UIGestureEnvironment _updateGesturesForEvent:window:] + 286
    14  UIKit                               0x000000010205f7ad -[UIWindow sendEvent:] + 3989
    15  UIKit                               0x000000010200ca33 -[UIApplication sendEvent:] + 371
    16  UIKit                               0x00000001027feb6d __dispatchPreprocessedEventFromEventQueue + 3248
    17  UIKit                               0x00000001027f7817 __handleEventQueue + 4879
    18  CoreFoundation                      0x0000000104582311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    19  CoreFoundation                      0x000000010456759c __CFRunLoopDoSources0 + 556
    20  CoreFoundation                      0x0000000104566a86 __CFRunLoopRun + 918
    21  CoreFoundation                      0x0000000104566494 CFRunLoopRunSpecific + 420
    22  GraphicsServices                    0x0000000107910a6f GSEventRunModal + 161
    23  UIKit                               0x0000000101feef34 UIApplicationMain + 159
    24  HyundaiCapital                      0x000000010132a67f main + 111
    25  libdyld.dylib                       0x000000010610268d start + 1
    26  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Edit

1.How many subviews at most i can add into delegate of scrollview at a time? 2.I am only getting this crash if i am adding subviews more than 126?

Solution

Updating ILPDFKit worked for me.
Saurabh Prajapati
  • 2,348
  • 1
  • 24
  • 42

0 Answers0