2015-12-22 95 views
0

我知道這可能是一個長鏡頭,但我看到這個狂野的崩潰(無法重新生成)。我無法弄清楚它爲什麼會發生。我相信我所看到的是我的UIWebView試圖調用它的資源加載代理,但發現委託被釋放。但是,我的應用程序並沒有解除分配UIWebView,僅僅是出於各種原因的背景,我的WebViewDelegate沒有實現webView:identifierForInitialRequest:fromDataSource:方法。我已經削減了下面的崩潰長期以來我認爲是違規的線程,並會愛如果任何人都可以指出我在正確的方向。UIWebView在資源加載時崩潰的應用程序

Thread 0 Crashed: 
0 libobjc.A.dylib    0x00000001926abbd0 objc_msgSend + 16 
1 UIKit       0x0000000186a10b78 -[UIWebView webView:identifierForInitialRequest:fromDataSource:] + 88 
2 CoreFoundation     0x0000000182067dec __invoking___ + 140 
3 CoreFoundation     0x0000000181f66658 -[NSInvocation invoke] + 292 
4 CoreFoundation     0x0000000181f6b1ec -[NSInvocation invokeWithTarget:] + 64 
5 WebKitLegacy     0x00000001907e5750 -[_WebSafeForwarder forwardInvocation:] + 168 
6 CoreFoundation     0x0000000182065c5c ___forwarding___ + 436 
7 CoreFoundation     0x0000000181f6b088 _CF_forwarding_prep_0 + 88 
8 CoreFoundation     0x0000000182067dec __invoking___ + 140 
9 CoreFoundation     0x0000000181f66658 -[NSInvocation invoke] + 292 
10 WebCore      0x000000018f99a8f0 _ZL20HandleDelegateSourcePv + 116 
11 CoreFoundation     0x000000018201a320 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 20 
12 CoreFoundation     0x00000001820195c4 __CFRunLoopDoSources0 + 260 
13 CoreFoundation     0x0000000182017674  0x181f3c000 + 708 
14 CoreFoundation     0x0000000181f45660 CFRunLoopRunSpecific + 392 
15 GraphicsServices    0x000000018b07f5a0 GSEventRunModal + 164 
16 UIKit       0x000000018684a980 UIApplicationMain + 1484 
17 IMNOTTELLING     0x0000000100195fd8 main (main.m:14) 
18 libdyld.dylib     0x0000000192d06a04 start + 0 

Thread 4: 
0 libsystem_kernel.dylib   0x0000000192e1f078 __psynch_cvwait + 8 
1 WebCore      0x000000018f97fb98 _ZL19SendDelegateMessageP12NSInvocation + 612 
2 WebKitLegacy     0x000000019081aec0 _Z24CallResourceLoadDelegatePFP11objc_objectS0_P13objc_selectorzEP7WebViewS1_S0_S0_ + 152 
3 WebKitLegacy     0x00000001907e2364 _ZN20WebFrameLoaderClient32assignIdentifierToInitialRequestEmPN7WebCore14DocumentLoaderERKNS0_15ResourceRequestE + 316 
4 WebCore      0x000000018f8ef2d4 _ZN7WebCore14ResourceLoader15willSendRequestERNS_15ResourceRequestERKNS_16ResourceResponseE + 156 
5 WebCore      0x000000018f8ef1b8 _ZN7WebCore17SubresourceLoader15willSendRequestERNS_15ResourceRequestERKNS_16ResourceResponseE + 336 
6 WebCore      0x000000018f8eeec4 _ZN7WebCore14ResourceLoader4initERKNS_15ResourceRequestE + 308 
7 WebCore      0x000000018f8eebc0 _ZN7WebCore17SubresourceLoader12startLoadingEv + 52 
8 WebCore      0x000000018f8eeb0c _ZN7WebCore21ResourceLoadScheduler20servePendingRequestsEPNS0_15HostInformationENS_20ResourceLoadPriorityE + 520 
9 WebCore      0x000000018f8edf54 _ZN7WebCore21ResourceLoadScheduler23scheduleSubresourceLoadEPNS_5FrameEPNS_14CachedResourceERKNS_15ResourceRequestENS_20ResourceLoadPriorityERKNS_21ResourceLoaderOptionsE + 80 
10 WebCore      0x000000018f8eca84 _ZN7WebCore14CachedResource4loadEPNS_20CachedResourceLoaderERKNS_21ResourceLoaderOptionsE + 1176 
11 WebCore      0x000000018f8ea558 _ZN7WebCore20CachedResourceLoader15requestResourceENS_14CachedResource4TypeERNS_21CachedResourceRequestE + 1236 
12 WebCore      0x000000018faebbf8 _ZN7WebCore20CachedResourceLoader18requestRawResourceERNS_21CachedResourceRequestE + 40 
13 WebCore      0x000000018faeb74c _ZN7WebCore24DocumentThreadableLoader11loadRequestERKNS_15ResourceRequestENS_19SecurityCheckPolicyE + 248 
14 WebCore      0x000000018fc9f5fc _ZN7WebCore24DocumentThreadableLoader34makeSimpleCrossOriginAccessRequestERKNS_15ResourceRequestE + 124 
15 WebCore      0x000000018fc9f448 _ZN7WebCore24DocumentThreadableLoader28makeCrossOriginAccessRequestERKNS_15ResourceRequestE + 256 
16 WebCore      0x000000018fc9f288 _ZN7WebCore24DocumentThreadableLoaderC2ERNS_8DocumentERNS_22ThreadableLoaderClientENS0_16BlockingBehaviorERKNS_15ResourceRequestERKNS_23ThreadableLoaderOptionsE + 504 
17 WebCore      0x000000018fc9f044 _ZN7WebCore24DocumentThreadableLoader6createERNS_8DocumentERNS_22ThreadableLoaderClientERKNS_15ResourceRequestERKNS_23ThreadableLoaderOptionsE + 68 
18 WebCore      0x000000018faeb624 _ZN7WebCore16ThreadableLoader6createEPNS_22ScriptExecutionContextEPNS_22ThreadableLoaderClientERKNS_15ResourceRequestERKNS_23ThreadableLoaderOptionsE + 156 
19 WebCore      0x000000018faeb24c _ZN7WebCore14XMLHttpRequest13createRequestERi + 1132 
20 WebCore      0x000000018faeadc0 _ZN7WebCore14XMLHttpRequest4sendERKN3WTF6StringERi + 832 
21 WebCore      0x000000018faea61c _ZN7WebCore16JSXMLHttpRequest4sendEPN3JSC9ExecStateE + 252 
22 JavaScriptCore     0x000000018384262c  0x1834ac000 + 26140 
23 JavaScriptCore     0x0000000183842058 llint_entry + 24648 
24 JavaScriptCore     0x0000000183842058 llint_entry + 24648 
25 JavaScriptCore     0x0000000183841ff4  0x1834ac000 + 24548 
26 JavaScriptCore     0x0000000183841ff4  0x1834ac000 + 24548 
27 JavaScriptCore     0x0000000183841ff4  0x1834ac000 + 24548 
28 JavaScriptCore     0x0000000183841ff4  0x1834ac000 + 24548 
29 JavaScriptCore     0x0000000183842058 llint_entry + 24648 
30 JavaScriptCore     0x000000018383bdf0 callToJavaScript + 304 
31 JavaScriptCore     0x00000001837aa454 _ZN3JSC7JITCode7executeEPNS_2VMEPNS_14ProtoCallFrameE + 44 
32 JavaScriptCore     0x0000000183515554 _ZN3JSC11Interpreter11executeCallEPNS_9ExecStateEPNS_8JSObjectENS_8CallTypeERKNS_8CallDataENS_7JSValueERKNS_7ArgListE + 416 
33 JavaScriptCore     0x00000001836414a4 _ZN3JSC4callEPNS_9ExecStateENS_7JSValueENS_8CallTypeERKNS_8CallDataES2_RKNS_7ArgListEPS2_ + 88 
34 WebCore      0x000000018f8de73c _ZN7WebCore15ScheduledAction24executeFunctionInContextEPN3JSC14JSGlobalObjectENS1_7JSValueEPNS_22ScriptExecutionContextE + 488 
35 WebCore      0x000000018f8de2d0 _ZN7WebCore15ScheduledAction7executeEPNS_8DocumentE + 140 
36 WebCore      0x000000018f8dda74 _ZN7WebCore8DOMTimer5firedEv + 504 
37 WebCore      0x000000018f8dd4dc _ZN7WebCore12ThreadTimers24sharedTimerFiredInternalEv + 144 
38 WebCore      0x000000018f8dd420 _ZN7WebCoreL10timerFiredEP16__CFRunLoopTimerPv + 32 
39 CoreFoundation     0x000000018201a20c __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 24 
40 CoreFoundation     0x0000000182019ebc __CFRunLoopDoTimer + 884 
41 CoreFoundation     0x0000000182017908  0x181f3c000 + 1368 
42 CoreFoundation     0x0000000181f45660 CFRunLoopRunSpecific + 392 
43 WebCore      0x000000018f964554 _ZL12RunWebThreadPv + 464 
44 libsystem_pthread.dylib  0x0000000192ebbe7c _pthread_body + 160 
45 libsystem_pthread.dylib  0x0000000192ebbdd8 _pthread_start + 156 
46 libsystem_pthread.dylib  0x0000000192eb8fac thread_start + 0 
+0

你設法解決這一問題?我有類似的崩潰報告。 – Micheal

+0

不知道我們是否真的解決了根本原因,但是我們發現了一些Web視圖,我們沒有正確保留我們的委託,因此一些JavaScript回調試圖通過調用並崩潰。 –

回答

1

我已經有這個問題一段時間了,以及在找出原因之前。我一直呼籲removeFromSuperviewUIView含有我們的UIWebView沒有nil輸出UIWebView的代表。所以我猜UIWebView必須始終有一個活動的視圖層次,除非它的代表是nil

Objective-C的

// Make sure this code is called before `removeFromSuperview` 
webView.delegate = nil; 
[webView loadHTMLString: @"about:blank" baseURL: nil]; 
[webView stopLoading]; 

斯威夫特

// Make sure this code is called before `removeFromSuperview` 
webView.delegate = nil 
webView.loadHTMLString("about:blank", baseURL: nil) 
webView.stopLoading() 
相關問題