title: Unable to reproduce WebKitLegacy -[_WebSafeForwarder forwardInvocation:] crash
body: <p>I am Getting [_WebSafeForwarder forwardInvocation:] and crash report as following on crashlytics. Unable to reproduce the same condition in my code. I added <code>webview.delegate = nil</code> and <code>[webview stopLoading]</code> in each and every <code>-(void)dealloc</code> method where ever  <code>UIWebview</code> is present still getting following crash.</p>
  
  <pre><code>#0. Crashed: com.apple.main-thread
  0  libobjc.A.dylib                0x24deba86 objc_msgSend + 5
  1  WebKitLegacy                   0x29945e17 -[_WebSafeForwarder forwardInvocation:] + 190
  2  CoreFoundation                 0x25624f4d ___forwarding___ + 352
  3  CoreFoundation                 0x2554f298 _CF_forwarding_prep_0 + 24
  4  CoreFoundation                 0x25626664 __invoking___ + 68
  5  CoreFoundation                 0x2554b8bd -[NSInvocation invoke] + 292
  6  WebCore                        0x28d6b84b HandleDelegateSource(void*) + 90
  7  CoreFoundation                 0x255e39e7 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
  8  CoreFoundation                 0x255e3569 __CFRunLoopDoSources0 + 344
  9  CoreFoundation                 0x255e193f __CFRunLoopRun + 806
  10 CoreFoundation                 0x255301c9 CFRunLoopRunSpecific + 516
  11 CoreFoundation                 0x2552ffbd CFRunLoopRunInMode + 108
  12 UIFoundation                   0x29bb5837 -[NSHTMLReader _loadUsingWebKit] + 2038
  13 Foundation                     0x25e4e887 __NSThreadPerformPerform + 386
  14 CoreFoundation                 0x255e39e7 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
  15 CoreFoundation                 0x255e3569 __CFRunLoopDoSources0 + 344
  16 CoreFoundation                 0x255e193f __CFRunLoopRun + 806
  17 CoreFoundation                 0x255301c9 CFRunLoopRunSpecific + 516
  18 CoreFoundation                 0x2552ffbd CFRunLoopRunInMode + 108
  19 GraphicsServices               0x26b4caf9 GSEventRunModal + 160
  20 UIKit                          0x29c68435 UIApplicationMain + 144
  21 MyProjectName        0x1446e5 main (main.m:14)
  22 libdispatch.dylib              0x251dc873 (Missing)
  
  --
  
  #0. Crashed: com.apple.main-thread
  0  libobjc.A.dylib                0x24deba86 objc_msgSend + 5
  1  WebKitLegacy                   0x29945e17 -[_WebSafeForwarder forwardInvocation:] + 190
  2  CoreFoundation                 0x25624f4d ___forwarding___ + 352
  3  CoreFoundation                 0x2554f298 _CF_forwarding_prep_0 + 24
  4  CoreFoundation                 0x25626664 __invoking___ + 68
  5  CoreFoundation                 0x2554b8bd -[NSInvocation invoke] + 292
  6  WebCore                        0x28d6b84b HandleDelegateSource(void*) + 90
  7  CoreFoundation                 0x255e39e7 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
  8  CoreFoundation                 0x255e3569 __CFRunLoopDoSources0 + 344
  9  CoreFoundation                 0x255e193f __CFRunLoopRun + 806
  10 CoreFoundation                 0x255301c9 CFRunLoopRunSpecific + 516
  11 CoreFoundation                 0x2552ffbd CFRunLoopRunInMode + 108
  12 UIFoundation                   0x29bb5837 -[NSHTMLReader _loadUsingWebKit] + 2038
  13 Foundation                     0x25e4e887 __NSThreadPerformPerform + 386
  14 CoreFoundation                 0x255e39e7 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
  15 CoreFoundation                 0x255e3569 __CFRunLoopDoSources0 + 344
  16 CoreFoundation                 0x255e193f __CFRunLoopRun + 806
  17 CoreFoundation                 0x255301c9 CFRunLoopRunSpecific + 516
  18 CoreFoundation                 0x2552ffbd CFRunLoopRunInMode + 108
  19 GraphicsServices               0x26b4caf9 GSEventRunModal + 160
  20 UIKit                          0x29c68435 UIApplicationMain + 144
  21 MyProjectName        0x1446e5 main (main.m:14)
  22 libdispatch.dylib              0x251dc873 (Missing)
  
  #2. com.twitter.crashlytics.ios.MachExceptionServer
  0  MyProjectName        0x157cdd CLSProcessRecordAllThreads + 1015005
  1  MyProjectName        0x157cdd CLSProcessRecordAllThreads + 1015005
  2  MyProjectName        0x157ef5 CLSProcessRecordAllThreads + 1015541
  3  MyProjectName        0x14c52b CLSHandler + 967979
  4  MyProjectName        0x148249 CLSMachExceptionServer + 950857
  5  libsystem_pthread.dylib        0x25354c7f _pthread_body + 138
  6  libsystem_pthread.dylib        0x25354bf3 _pthread_start + 110
  7  libsystem_pthread.dylib        0x25352a08 thread_start + 8
  
  #3. GAIThread
  0  libsystem_kernel.dylib         0x2529b8a8 mach_msg_trap + 20
  1  libsystem_kernel.dylib         0x2529b6a9 mach_msg + 40
  2  CoreFoundation                 0x255e36ad __CFRunLoopServiceMachPort + 136
  3  CoreFoundation                 0x255e1a33 __CFRunLoopRun + 1050
  4  CoreFoundation                 0x255301c9 CFRunLoopRunSpecific + 516
  5  CoreFoundation                 0x2552ffbd CFRunLoopRunInMode + 108
  6  Foundation                     0x25d7d42d -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 268
  7  Foundation                     0x25dcbd75 -[NSRunLoop(NSRunLoop) run] + 80
  8  MyProjectName        0x1d58c5 +[GAI threadMain:] + 1530053
  9  Foundation                     0x25e4e64d __NSThread__start__ + 1144
  10 libsystem_pthread.dylib        0x25354c7f _pthread_body + 138
  11 libsystem_pthread.dylib        0x25354bf3 _pthread_start + 110
  12 libsystem_pthread.dylib        0x25352a08 thread_start + 8
  
  #4. com.apple.NSURLConnectionLoader
  0  libsystem_kernel.dylib         0x2529b8a8 mach_msg_trap + 20
  1  libsystem_kernel.dylib         0x2529b6a9 mach_msg + 40
  2  CoreFoundation                 0x255e36ad __CFRunLoopServiceMachPort + 136
  3  CoreFoundation                 0x255e1a33 __CFRunLoopRun + 1050
  4  CoreFoundation                 0x255301c9 CFRunLoopRunSpecific + 516
  5  CoreFoundation                 0x2552ffbd CFRunLoopRunInMode + 108
  6  CFNetwork                      0x25b85c47 +[NSURLConnection(Loader) _resourceLoadLoop:] + 486
  7  Foundation                     0x25e4e64d __NSThread__start__ + 1144
  8  libsystem_pthread.dylib        0x25354c7f _pthread_body + 138
  9  libsystem_pthread.dylib        0x25354bf3 _pthread_start + 110
  10 libsystem_pthread.dylib        0x25352a08 thread_start + 8
  
  #5. com.apple.CFSocket.private
  0  libsystem_kernel.dylib         0x252afeec __select + 20
  1  CoreFoundation                 0x255e8b51 __CFSocketManager + 572
  2  libsystem_pthread.dylib        0x25354c7f _pthread_body + 138
  3  libsystem_pthread.dylib        0x25354bf3 _pthread_start + 110
  4  libsystem_pthread.dylib        0x25352a08 thread_start + 8
  
  #6. AFNetworking
  0  libsystem_kernel.dylib         0x2529b8a8 mach_msg_trap + 20
  1  libsystem_kernel.dylib         0x2529b6a9 mach_msg + 40
  2  CoreFoundation                 0x255e36ad __CFRunLoopServiceMachPort + 136
  3  CoreFoundation                 0x255e1a33 __CFRunLoopRun + 1050
  4  CoreFoundation                 0x255301c9 CFRunLoopRunSpecific + 516
  5  CoreFoundation                 0x2552ffbd CFRunLoopRunInMode + 108
  6  Foundation                     0x25d7d42d -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 268
  7  Foundation                     0x25dcbd75 -[NSRunLoop(NSRunLoop) run] + 80
  8  MyProjectName        0x29d30f +[AFURLConnectionOperation networkRequestThreadEntryPoint:] (AFURLConnectionOperation.m:168)
  9  Foundation                     0x25e4e64d __NSThread__start__ + 1144
  10 libsystem_pthread.dylib        0x25354c7f _pthread_body + 138
  11 libsystem_pthread.dylib        0x25354bf3 _pthread_start + 110
  12 libsystem_pthread.dylib        0x25352a08 thread_start + 8
  
  #7. WebThread
  0  libsystem_kernel.dylib         0x252af998 __psynch_cvwait + 24
  1  libsystem_pthread.dylib        0x253541a5 _pthread_cond_wait + 536
  2  libsystem_pthread.dylib        0x253550f9 pthread_cond_timedwait + 44
  3  WebCore                        0x28d57f57 SendDelegateMessage(NSInvocation*) + 678
  4  WebKitLegacy                   0x29978265 CallFrameLoadDelegate(void (*)(), WebView*, objc_selector*, objc_object*) + 172
  5  WebKitLegacy                   0x29947877 WebFrameLoaderClient::dispatchDidFinishLoad() + 158
  6  WebCore                        0x28d290af WebCore::FrameLoader::checkLoadCompleteForThisFrame() + 382
  7  WebCore                        0x28d28e75 WebCore::FrameLoader::checkLoadComplete() + 280
  8  WebCore                        0x28d55bf1 WebCore::FrameLoader::checkCompleted() + 316
  9  WebCore                        0x28d5504b WebCore::FrameLoader::finishedParsing() + 102
  10 WebCore                        0x28d54f59 WebCore::Document::finishedParsing() + 312
  11 WebCore                        0x28d5270b WebCore::HTMLDocumentParser::prepareToStopParsing() + 118
  12 WebCore                        0x28dddbcb WebCore::HTMLDocumentParser::resumeParsingAfterYield() + 102
  13 WebCore                        0x28cff4a1 WebCore::ThreadTimers::sharedTimerFiredInternal() + 136
  14 WebCore                        0x28cff3f5 WebCore::timerFired(__CFRunLoopTimer*, void*) + 28
  15 CoreFoundation                 0x255e4177 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 14
  16 CoreFoundation                 0x255e3da9 __CFRunLoopDoTimer + 936
  17 CoreFoundation                 0x255e1bf5 __CFRunLoopRun + 1500
  18 CoreFoundation                 0x255301c9 CFRunLoopRunSpecific + 516
  19 CoreFoundation                 0x2552ffbd CFRunLoopRunInMode + 108
  20 WebCore                        0x28d457b7 RunWebThread(void*) + 422
  21 libsystem_pthread.dylib        0x25354c7f _pthread_body + 138
  22 libsystem_pthread.dylib        0x25354bf3 _pthread_start + 110
  23 libsystem_pthread.dylib        0x25352a08 thread_start + 8
  
  #8. JavaScriptCore::Marking
  0  libsystem_kernel.dylib         0x252af998 __psynch_cvwait + 24
  1  libsystem_pthread.dylib        0x253541a5 _pthread_cond_wait + 536
  2  libsystem_pthread.dylib        0x253550b9 pthread_cond_wait + 40
  3  libc++.1.dylib                 0x24d7469d std::__1::condition_variable::wait(std::__1::unique_lock&lt;std::__1::mutex&gt;&amp;) + 36
  4  JavaScriptCore                 0x2891a781 JSC::GCThread::waitForNextPhase() + 104
  5  JavaScriptCore                 0x2891a7ef JSC::GCThread::gcThreadMain() + 62
  6  JavaScriptCore                 0x287269e1 WTF::threadEntryPoint(void*) + 148
  7  JavaScriptCore                 0x2872693f WTF::wtfThreadEntryPoint(void*) + 14
  8  libsystem_pthread.dylib        0x25354c7f _pthread_body + 138
  9  libsystem_pthread.dylib        0x25354bf3 _pthread_start + 110
  10 libsystem_pthread.dylib        0x25352a08 thread_start + 8
  
  #9. NSOperationQueue 0x15e6cc20 :: NSOperation 0x15d230e0 (QOS: USER_INTERACTIVE)
  0  libsystem_kernel.dylib         0x2529b8f8 semaphore_wait_trap + 8
  1  libsystem_platform.dylib       0x2534f289 _os_semaphore_wait + 12
  2  libdispatch.dylib              0x251bcc6d _dispatch_barrier_sync_f_slow + 372
  3  MyProjectName        0x27dd8f __69-[SDWebImageManager downloadImageWithURL:options:progress:completed:]_block_invoke98 (SDWebImageManager.m:189)
  4  MyProjectName        0x275e71 __72-[SDWebImageDownloader downloadImageWithURL:options:progress:completed:]_block_invoke93 (SDWebImageDownloader.m:163)
  5  MyProjectName        0x27a8fb -[SDWebImageDownloaderOperation connection:didFailWithError:] (SDWebImageDownloaderOperation.m:419)
  6  CFNetwork                      0x25c683a1 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 56
  7  CFNetwork                      0x25c68359 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 184
  8  CFNetwork                      0x25c6847d -[NSURLConnectionInternal _withConnectionAndDelegate:] + 36
  9  CFNetwork                      0x25c44125 _NSURLConnectionDidFail(_CFURLConnection*, __CFError*, void const*) + 84
  10 CFNetwork                      0x25be3203 ___ZN27URLConnectionClient_Classic17_delegate_didFailEP9__CFErrorU13block_pointerFvvE_block_invoke + 86
  11 CFNetwork                      0x25be1a83 ___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 70
  12 libdispatch.dylib              0x251b3cab _dispatch_client_callout + 22
  13 libdispatch.dylib              0x251bb543 _dispatch_block_invoke + 450
  14 CFNetwork                      0x25b13e83 RunloopBlockContext::_invoke_block(void const*, void*) + 18
  15 CoreFoundation                 0x2552fc09 CFArrayApplyFunction + 36
  16 CFNetwork                      0x25b13d6b RunloopBlockContext::perform() + 182
  17 CFNetwork                      0x25b13c35 MultiplexerSource::perform() + 216
  18 CFNetwork                      0x25b13ac9 MultiplexerSource::_perform(void*) + 48
  19 CoreFoundation                 0x255e39e7 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
  20 CoreFoundation                 0x255e35d7 __CFRunLoopDoSources0 + 454
  21 CoreFoundation                 0x255e193f __CFRunLoopRun + 806
  22 CoreFoundation                 0x255301c9 CFRunLoopRunSpecific + 516
  23 CoreFoundation                 0x25570f23 CFRunLoopRun + 98
  24 MyProjectName        0x27779b -[SDWebImageDownloaderOperation start] (SDWebImageDownloaderOperation.m:117)
  25 Foundation                     0x25e38b0d __NSOQSchedule_f + 192
  26 libdispatch.dylib              0x251bde7f _dispatch_queue_drain + 1762
  27 libdispatch.dylib              0x251b6e17 _dispatch_queue_invoke + 282
  28 libdispatch.dylib              0x251bf20d _dispatch_root_queue_drain + 400
  29 libdispatch.dylib              0x251bf07b _dispatch_worker_thread3 + 94
  30 libsystem_pthread.dylib        0x25352e0d _pthread_wqthread + 1024
  31 libsystem_pthread.dylib        0x253529fc start_wqthread + 8
  
  #10. com.apple.root.default-qos
  0  libsystem_kernel.dylib         0x252af998 __psynch_cvwait + 24
  1  libsystem_pthread.dylib        0x253541a5 _pthread_cond_wait + 536
  2  libsystem_pthread.dylib        0x253550b9 pthread_cond_wait + 40
  3  Foundation                     0x25dc840f -[NSCondition wait] + 194
  4  Foundation                     0x25d8f40b -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 850
  5  Foundation                     0x25d92be1 -[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:] + 136
  6  UIFoundation                   0x29bb611f -[NSHTMLReader _load] + 386
  7  UIFoundation                   0x29bb6b21 -[NSHTMLReader attributedString] + 24
  8  UIFoundation                   0x29b5ac35 _NSReadAttributedStringFromURLOrData + 5304
  9  UIFoundation                   0x29b596f5 -[NSAttributedString(NSAttributedStringUIFoundationAdditions) initWithData:options:documentAttributes:error:] + 116
  10 MyProjectName        0x19cecf -[MyStaticLibrary handleHTMLCharactersForTitle:] (MyStaticLibrary.m:3132)
  11 MyProjectName        0x1a8905 __47-[MyNetworkRequest onHTTPSuccessWithResponse:]_block_invoke143 (MyNetworkRequest.m:484)
  12 libdispatch.dylib              0x251b3cbf _dispatch_call_block_and_release + 10
  13 libdispatch.dylib              0x251bf6a1 _dispatch_root_queue_drain + 1572
  14 libdispatch.dylib              0x251bf07b _dispatch_worker_thread3 + 94
  15 libsystem_pthread.dylib        0x25352e0d _pthread_wqthread + 1024
  16 libsystem_pthread.dylib        0x253529fc start_wqthread + 8
  
  #11. Thread
  0  libsystem_kernel.dylib         0x252afffc __semwait_signal + 24
  1  libsystem_c.dylib              0x25203bcd nanosleep + 172
  2  libc++.1.dylib                 0x24db38f5 std::__1::this_thread::sleep_for(std::__1::chrono::duration&lt;long long, std::__1::ratio&lt;1ll, 1000000000ll&gt; &gt; const&amp;) + 136
  3  JavaScriptCore                 0x28ad9b01 bmalloc::Heap::scavenge(std::__1::unique_lock&lt;bmalloc::StaticMutex&gt;&amp;, std::__1::chrono::duration&lt;long long, std::__1::ratio&lt;1ll, 1000ll&gt; &gt;) + 256
  4  JavaScriptCore                 0x28ad98eb bmalloc::Heap::concurrentScavenge() + 78
  5  JavaScriptCore                 0x28adb7b7 bmalloc::AsyncTask&lt;bmalloc::Heap, void (bmalloc::Heap::*)()&gt;::entryPoint() + 98
  6  JavaScriptCore                 0x28adb751 bmalloc::AsyncTask&lt;bmalloc::Heap, void (bmalloc::Heap::*)()&gt;::pthreadEntryPoint(void*) + 8
  7  libsystem_pthread.dylib        0x25354c7f _pthread_body + 138
  8  libsystem_pthread.dylib        0x25354bf3 _pthread_start + 110
  9  libsystem_pthread.dylib        0x25352a08 thread_start + 8
  
  #12. Thread
  0  libsystem_pthread.dylib        0x253529f4 start_wqthread + 14
  
  #13. Thread
  0  libsystem_kernel.dylib         0x252b0864 __workq_kernreturn + 8
  1  libsystem_pthread.dylib        0x25352e19 _pthread_wqthread + 1036
  2  libsystem_pthread.dylib        0x253529fc start_wqthread + 8
  
  #14. Thread
  0  libsystem_kernel.dylib         0x252b0864 __workq_kernreturn + 8
  1  libsystem_pthread.dylib        0x25352e19 _pthread_wqthread + 1036
  2  libsystem_pthread.dylib        0x253529fc start_wqthread + 8
  
  #15. PLClientLoggingFlushQueue
  0  libsystem_platform.dylib       0x2534e96a _platform_memmove + 105
  1  CoreFoundation                 0x2553f0c7 CFStringGetBytes + 634
  2  CoreFoundation                 0x2553f0c7 CFStringGetBytes + 634
  3  CoreFoundation                 0x25677ab9 __writeObject15 + 324
  4  CoreFoundation                 0x2567841d __writeObject15 + 2728
  5  CoreFoundation                 0x2567841d __writeObject15 + 2728
  6  CoreFoundation                 0x2567841d __writeObject15 + 2728
  7  CoreFoundation                 0x2567841d __writeObject15 + 2728
  8  CoreFoundation                 0x2567841d __writeObject15 + 2728
  9  CoreFoundation                 0x256777ad __CFBinaryPlistWrite15 + 152
  10 CoreFoundation                 0x255729cf _CFXPCCreateXPCMessageWithCFObject + 118
  11 PowerLog                       0x2707ab4f -[PLClientLogger xpcSendMessage:withClientID:withKey:withPayload:] + 86
  12 PowerLog                       0x2707bd85 -[PLClientLogger batchTasksCacheFlush] + 500
  13 libdispatch.dylib              0x251b3cbf _dispatch_call_block_and_release + 10
  14 libdispatch.dylib              0x251bd3cf _dispatch_after_timer_callback + 66
  15 libdispatch.dylib              0x251c65bb _dispatch_source_latch_and_call + 2042
  16 libdispatch.dylib              0x251b5bff _dispatch_source_invoke + 738
  17 libdispatch.dylib              0x251bd9ed _dispatch_queue_drain + 592
  18 libdispatch.dylib              0x251b6e17 _dispatch_queue_invoke + 282
  19 libdispatch.dylib              0x251bf20d _dispatch_root_queue_drain + 400
  20 libdispatch.dylib              0x251bf07b _dispatch_worker_thread3 + 94
  21 libsystem_pthread.dylib        0x25352e0d _pthread_wqthread + 1024
  22 libsystem_pthread.dylib        0x253529fc start_wqthread + 8
  </code></pre>