Hi, I have no idea what caused this error "completion handler passed to -[MyApp.MainVC webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:] was not called " can you guys please help me to find it?
Here is the code for JavaScriptAlertPanelWithMessage
func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo,
completionHandler: @escaping () -> Void) {
let alertController = UIAlertController(title: nil, message: message, preferredStyle: .actionSheet)
if self.presentingViewController == nil{
alertController.addAction(UIAlertAction(title: "Ok", style: .cancel, handler: { (action) in
completionHandler()
}))
if UIDevice.current.userInterfaceIdiom != .phone {
alertController.addAction(UIAlertAction(title: "Ok", style: .default, handler: { (action) in
completionHandler()
}))
if let popoverController = alertController.popoverPresentationController {
popoverController.sourceView = self.view
popoverController.sourceRect = CGRect(x: self.view.bounds.midX, y: self.view.bounds.midY, width: 0, height: 0)
popoverController.permittedArrowDirections = []
}
}
self.present(alertController, animated: true, completion: nil)
}
}
Here is the crash logs from crashlytics.
Fatal Exception: NSInternalInconsistencyException
0 CoreFoundation 0x1817e2d8c __exceptionPreprocess
1 libobjc.A.dylib 0x18099c5ec objc_exception_throw
2 CoreFoundation 0x1817e2c6c -[NSException initWithCoder:]
3 WebKit 0x1911b8688 WebKit::CompletionHandlerCallChecker::~CompletionHandlerCallChecker()
4 WebKit 0x1911c2ee0 ***::ThreadSafeRefCounted::deref() const
5 WebKit 0x1912c6f48 ***::BlockPtr ***::BlockPtr::fromCallable<webkit::uidelegate::uiclient::runjavascriptalert(webkit::webpageproxy*, ***::string="" const&,="" webkit::webframeproxy*,="" webcore::securityorigindata="" ***::function<void="" ()="">&&)::$_1>(WebKit::UIDelegate::UIClient::runJavaScriptAlert(WebKit::WebPageProxy*, ***::String const&, WebKit::WebFrameProxy*, WebCore::SecurityOriginData const&, ***::Function&&)::$_1)::'lambda'(void const*)::__invoke(void const*)
6 libsystem_blocks.dylib 0x181174a5c _Block_release
7 MyApp 0x102a87830 partial apply for MainVC.(webView(WKWebView, didStartProvisionalNavigation : WKNavigation!) -> ()).(closure #3) (MainVC.swift)
8 libswiftCore.dylib 0x10310cf04 (Missing)
9 MyApp 0x102a87884 ObjCBool (MainVC.swift)
10 libswiftCore.dylib 0x10310cf04 (Missing)
11 libsystem_blocks.dylib 0x181174a5c _Block_release
12 UIKit 0x18b5ebfb8 -[UIAlertController _clearActionHandlers]
13 UIKit 0x18b5ebcb8 -[UIAlertController dealloc]
14 UIKit 0x18b5eb970 -[UIPresentationController .cxx_destruct]
15 libobjc.A.dylib 0x18099aef4 object_cxxDestructFromClass(objc_object*, objc_class*)
16 libobjc.A.dylib 0x1809a8990 objc_destructInstance
17 libobjc.A.dylib 0x1809a89f8 object_dispose
18 UIKit 0x18b5eb260 -[UIPresentationController dealloc]
19 UIKit 0x18b5ea694 -[UIViewController _didFinishDismissTransition]
20 UIKit 0x18b5e9050 -[UIPresentationController transitionDidFinish:]
21 UIKit 0x18ba14430 -[_UICurrentContextPresentationController transitionDidFinish:]
22 UIKit 0x18b87ac88 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke.436
23 UIKit 0x18b3ecb88 -[_UIViewControllerTransitionContext completeTransition:]
24 UIKit 0x18b45a678 -[UITransitionView notifyDidCompleteTransition:]
25 UIKit 0x18b45a230 -[UITransitionView _didCompleteTransition:]
26 UIKit 0x18b6f5be4 -[UITransitionView _transitionDidStop:finished:]
27 UIKit 0x18b3ec0b8 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:]
28 UIKit 0x18b4d5fcc -[UIViewAnimationState animationDidStop:finished:]
29 UIKit 0x18b4d606c -[UIViewAnimationState animationDidStop:finished:]
30 QuartzCore 0x18597b36c CA::Layer::run_animation_callbacks(void*)
31 libdispatch.dylib 0x1810d4a60 _dispatch_client_callout
32 libdispatch.dylib 0x1810e165c _dispatch_main_queue_callback_4CF$VARIANT$mp
33 CoreFoundation 0x18178b070 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
34 CoreFoundation 0x181788bc8 __CFRunLoopRun
35 CoreFoundation 0x1816a8da8 CFRunLoopRunSpecific
36 GraphicsServices 0x18368e020 GSEventRunModal
37 UIKit 0x18b6c8758 UIApplicationMain
38 MyApp 0x102a82520 main (MainVC.swift:17)
39 libdyld.dylib 0x181139fc0 start
#0. Crashed: com.twitter.crashlytics.ios.exception
0 MyApp 0x102aa85ac CLSProcessRecordAllThreads (CLSProcess.c:376)
1 MyApp 0x102aa85ac CLSProcessRecordAllThreads (CLSProcess.c:376)
2 MyApp 0x102aa8a20 CLSProcessRecordAllThreads (CLSProcess.c:407)
3 MyApp 0x102a98060 CLSHandler (CLSHandler.m:26)
4 MyApp 0x102aa6b18 __CLSExceptionRecord_block_invoke (CLSException.mm:199)
5 libdispatch.dylib 0x1810d4a60 _dispatch_client_callout + 16
6 libdispatch.dylib 0x1810dd5bc _dispatch_queue_barrier_sync_invoke_and_complete + 56
7 MyApp 0x102aa6594 CLSExceptionRecord (CLSException.mm:206)
8 MyApp 0x102aa63c4 CLSExceptionRecordNSException (CLSException.mm:102)
9 MyApp 0x102aa5fc4 CLSTerminateHandler() (CLSException.mm:259)
10 libc++abi.dylib 0x18098d37c std::__terminate(void (*)()) + 16
11 libc++abi.dylib 0x18098cccc __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*) + 130
12 libobjc.A.dylib 0x18099c720 _objc_exception_destructor(void*) + 362
13 CoreFoundation 0x1817e2c6c -[NSException initWithCoder:] + 114
14 WebKit 0x1911b8688 WebKit::CompletionHandlerCallChecker::~CompletionHandlerCallChecker() + 144
15 WebKit 0x1911c2ee0 ***::ThreadSafeRefCounted::deref() const + 40
16 WebKit 0x1912c6f48 ***::BlockPtr ***::BlockPtr::fromCallable<webkit::uidelegate::uiclient::runjavascriptalert(webkit::webpageproxy*, ***::string="" const&,="" webkit::webframeproxy*,="" webcore::securityorigindata="" ***::function<void="" ()="">&&)::$_1>(WebKit::UIDelegate::UIClient::runJavaScriptAlert(WebKit::WebPageProxy*, ***::String const&, WebKit::WebFrameProxy*, WebCore::SecurityOriginData const&, ***::Function&&)::$_1)::'lambda'(void const*)::__invoke(void const*) + 32
17 libsystem_blocks.dylib 0x181174a5c _Block_release + 152
18 MyApp 0x102a87830 partial apply for MainVC.(webView(WKWebView, didStartProvisionalNavigation : WKNavigation!) -> ()).(closure #3) (MainVC.swift)
19 libswiftCore.dylib 0x10310cf04 swift_unownedCheck + 88
20 MyApp 0x102a87884 ObjCBool (MainVC.swift)
21 libswiftCore.dylib 0x10310cf04 swift_unownedCheck + 88
22 libsystem_blocks.dylib 0x181174a5c _Block_release + 152
23 UIKit 0x18b5ebfb8 -[UIAlertController _clearActionHandlers] + 204
24 UIKit 0x18b5ebcb8 -[UIAlertController dealloc] + 352
25 UIKit 0x18b5eb970 -[UIPresentationController .cxx_destruct] + 372
26 libobjc.A.dylib 0x18099aef4 object_cxxDestructFromClass(objc_object*, objc_class*) + 148
27 libobjc.A.dylib 0x1809a8990 objc_destructInstance + 68
28 libobjc.A.dylib 0x1809a89f8 object_dispose + 16
29 UIKit 0x18b5eb260 -[UIPresentationController dealloc] + 60
30 UIKit 0x18b5ea694 -[UIViewController _didFinishDismissTransition] + 564
31 UIKit 0x18b5e9050 -[UIPresentationController transitionDidFinish:] + 532
32 UIKit 0x18ba14430 -[_UICurrentContextPresentationController transitionDidFinish:] + 40
33 UIKit 0x18b87ac88 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke.436 + 188
34 UIKit 0x18b3ecb88 -[_UIViewControllerTransitionContext completeTransition:] + 116
35 UIKit 0x18b45a678 -[UITransitionView notifyDidCompleteTransition:] + 252
36 UIKit 0x18b45a230 -[UITransitionView _didCompleteTransition:] + 1132
37 UIKit 0x18b6f5be4 -[UITransitionView _transitionDidStop:finished:] + 120
38 UIKit 0x18b3ec0b8 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 312
39 UIKit 0x18b4d5fcc -[UIViewAnimationState animationDidStop:finished:] + 296
40 UIKit 0x18b4d606c -[UIViewAnimationState animationDidStop:finished:] + 456
41 QuartzCore 0x18597b36c CA::Layer::run_animation_callbacks(void*) + 284
42 libdispatch.dylib 0x1810d4a60 _dispatch_client_callout + 16
43 libdispatch.dylib 0x1810e165c _dispatch_main_queue_callback_4CF$VARIANT$mp + 1012
44 CoreFoundation 0x18178b070 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
45 CoreFoundation 0x181788bc8 __CFRunLoopRun + 2272
46 CoreFoundation 0x1816a8da8 CFRunLoopRunSpecific + 552
47 GraphicsServices 0x18368e020 GSEventRunModal + 100
48 UIKit 0x18b6c8758 UIApplicationMain + 236
49 MyApp 0x102a82520 main (MainVC.swift:17)
50 libdyld.dylib 0x181139fc0 start + 4
Thank you very much.