4 Replies
      Latest reply on Dec 3, 2019 8:16 PM by DevG
      chandanfromnoida Level 1 Level 1 (0 points)

        I'm developing an iOS application in Swift. My WKWebview is crashing on iOS 13. I am using a web view inside a UIScrollView. Crashlyics showing me crash on WebCore -[WAKView addSubview:].  Here is my app crash report


        Fatal Exception: NSInvalidArgumentException
          0 CoreFoundation 0x19c91180c __exceptionPreprocess
          1 libobjc.A.dylib 0x19c639fa4 objc_exception_throw
          2 CoreFoundation 0x19c967350 -[__NSCFString characterAtIndex:].cold.1
          3 CoreFoundation 0x19c968ba4 -[__NSSetM addObject:].cold.2
          4 CoreFoundation 0x19c7edf60 -[__NSSetM addObject:]
          5 WebCore 0x1a4433fc4 -[WAKView addSubview:]
          6 WebKitLegacy 0x1a87dc6e4 -[WebFrameView(WebInternal) _setDocumentView:]
          7 WebKitLegacy 0x1a88ad3d4 -[WebFrameView(WebInternal) _makeDocumentViewForDataSource:]
          8 WebKitLegacy 0x1a88aa42c WebFrameLoaderClient::transitionToCommittedForNewPage()
          9 WebCore 0x1a55da774 WebCore::FrameLoader::transitionToCommitted(WebCore::CachedPage*)
          10 WebCore 0x1a55d9f10 WebCore::FrameLoader::commitProvisionalLoad()
          11 WebCore 0x1a55b3d14 WebCore::DocumentLoader::finishedLoading()
          12 WebCore 0x1a563a7c8 WebCore::CachedResource::checkNotify()
          13 WebCore 0x1a5638784 WebCore::CachedRawResource::finishLoading(WebCore::SharedBuffer*)
          14 WebCore 0x1a560d7dc WebCore::SubresourceLoader::didFinishLoading(WebCore::NetworkLoadMetrics const&)
          15 WebCore 0x1a5605ab0 WebCore::ResourceLoader::didFinishLoading(WebCore::ResourceHandle*)
          16 WebCore 0x1a5dea6e0 ***::Detail::CallableWrapper<-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]::$_7, void>::call()
          17 JavaScriptCore 0x1ab5de6bc ***::dispatchFunctionsFromMainThread()
          18 Foundation 0x19ccfa24c __NSThreadPerformPerform
          19 CoreFoundation 0x19c88f7c4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
          20 CoreFoundation 0x19c88f71c __CFRunLoopDoSource0
          21 CoreFoundation 0x19c88eeb4 __CFRunLoopDoSources0
          22 CoreFoundation 0x19c88a000 __CFRunLoopRun
          23 CoreFoundation 0x19c8898a0 CFRunLoopRunSpecific
          24 WebCore 0x1a4823b60 RunWebThread(void*)
          25 libsystem_pthread.dylib 0x19c62e1d0 _pthread_start
          26 libsystem_pthread.dylib 0x19c631ae0 thread_start

        • Re: WKWebView crashing on iOS 13
          DevG Level 1 Level 1 (0 points)

          Hi Team,

          Similar issue is obseved in one our application too, below is the stack trace of crashed thread:

          Note: 98% crashes were been observed on iOS 13 while 1% each on iOS 12 and 11 version.


          Crash stack trace:

          Fatal Exception: NSInvalidArgumentException
          0  CoreFoundation                 0x1c562898c __exceptionPreprocess
          1  libobjc.A.dylib                0x1c53510a4 objc_exception_throw
          2  CoreFoundation                 0x1c567e3f8 -[__NSCFString characterAtIndex:].cold.1
          3  CoreFoundation                 0x1c567fc4c -[__NSSetM addObject:].cold.2
          4  CoreFoundation                 0x1c5505030 -[__NSSetM addObject:]
          5  WebCore                        0x1cd075f64 -[WAKView addSubview:]
          6  WebKitLegacy                   0x1d13d2794 -[WebFrameView(WebInternal) _setDocumentView:]
          7  WebKitLegacy                   0x1d14a3484 -[WebFrameView(WebInternal) _makeDocumentViewForDataSource:]
          8  WebKitLegacy                   0x1d14a04d8 WebFrameLoaderClient::transitionToCommittedForNewPage()
          9  WebCore                        0x1ce214ab0 WebCore::FrameLoader::transitionToCommitted(WebCore::CachedPage*)
          10 WebCore                        0x1ce21424c WebCore::FrameLoader::commitProvisionalLoad()
          11 WebCore                        0x1ce1ee2ac WebCore::DocumentLoader::finishedLoading()
          12 WebCore                        0x1ce2748f8 WebCore::CachedResource::checkNotify()
          13 WebCore                        0x1ce2728b4 WebCore::CachedRawResource::finishLoading(WebCore::SharedBuffer*)
          14 WebCore                        0x1ce24790c WebCore::SubresourceLoader::didFinishLoading(WebCore::NetworkLoadMetrics const&)
          15 WebCore                        0x1ce23fbe0 WebCore::ResourceLoader::didFinishLoading(WebCore::ResourceHandle*)
          16 WebCore                        0x1cea1c168 ***::Detail::CallableWrapper<-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]::$_7, void>::call()
          17 JavaScriptCore                 0x1d419cbcc ***::dispatchFunctionsFromMainThread()
          18 Foundation                     0x1c5a11238 __NSThreadPerformPerform
          19 CoreFoundation                 0x1c55a67e0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
          20 CoreFoundation                 0x1c55a6738 __CFRunLoopDoSource0
          21 CoreFoundation                 0x1c55a5ed0 __CFRunLoopDoSources0
          22 CoreFoundation                 0x1c55a101c __CFRunLoopRun
          23 CoreFoundation                 0x1c55a08bc CFRunLoopRunSpecific
          24 WebCore                        0x1cd45b100 RunWebThread(void*)
          25 libsystem_pthread.dylib        0x1c53451ec _pthread_start
          26 libsystem_pthread.dylib        0x1c5348aec thread_start

          Need quick pointers on what all can be possibilities of crash.

            • Re: WKWebView crashing on iOS 13
              Claude31 Level 8 Level 8 (7,245 points)

              So there are a lot of crashes. But not related to IOS version.

              Just after IOS1; see this old post with some how similar crash : https://forums.developer.apple.com/thread/77761


              Does it occur with some specific content (such as Javascript ) ?

              Is this content properly displayed in Safari ?


              Does it occur when you load video ? If so, see this:

              h ttps://answerstu.com/question-53659


              Which version of XCode ?

                • Re: WKWebView crashing on iOS 13
                  DevG Level 1 Level 1 (0 points)

                  Below are required details:


                  Does it occur with some specific content (such as Javascript ) ?

                  Is this content properly displayed in Safari ?

                  >> App is using web content at multiple places, so not able to track down, majorly suspecting HomePage which is renders web content on WKWebview, and also have scripts to render Google ads in between pre-defined div containers.

                  So we had tried with Google Video ads but were not able to replicate.


                  Does it occur when you load video ? If so, see this:

                  >> we have already tried with video contents in ads, but didn't faced any crash.



                  >> will check further on similar lines.


                  Which version of XCode ?

                  >> Xcode 10.1


                  Additional Details:

                       - One more observation crashes and users ratio is around 1:1

                       - Crash is not replicable, while getting crash reported for good number of users, seems its event or time driven vs just content loading.

              • Re: WKWebView crashing on iOS 13
                KMT Level 9 Level 9 (15,245 points)

                Why are you using webView inside a scrollView? AFAIK, webView has it's own scrollView.