I am trying to send message to native(written in swift) and in response of that, calling a javascript function for further process from native using WKWebView. The javascript is written maintaining callbacks so that further process continues. But after 2 callbacks application crashes. Its not giving any clear description of crash.
While debugging, the logs show message : " warning: could not execute support code to read Objective-C class data in the process. This may reduce the quality of type information available." and execution continues.
After 2 callbacks between javascript and native it crashes saying BAD_ACCESS
"Thread 1: EXC_BAD_ACCESS (code=2, address=0x13dd83d50)"
xcode 9.2
iOS 11.2.1
Where does
NativeBridge come from? Most
WKWebView-to-native tech is based on
WKScriptMessage. Is
NativeBridge a wrapper around that? Or something else?
btw Your ‘perform selector after delay’ stuff is super scary because it drags you outside of Swift’s type checked environment. I recommend that you use
DispatchQueue.main.asyncAfter(…) for this sort of thing; it’s based on closures and thus keeps you type safe.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"