You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I included XWebView into my code and it works:
WebView!.loadPlugin(jsObj(), namespace: "injectedObj")
In the injected object I have a method: @objc func getPlatform() -> String{
print(" PLARFORNN")
return "{"code":1}"
}
it works and prints on the iOS emulator console.
But it returns undefined in javascript code:
window.injectedObj.getPlatform(); // = undefined
could you give me a clue how can I get result from the method in javascipt in WebView?
Thanx
The text was updated successfully, but these errors were encountered:
Native method can't pass the result to JavaScript by return value, because the communication between native and javascript is asynchronous. You have to pass the result back to JavaScript by callback.
Plugin:
Hi,
I included XWebView into my code and it works:
WebView!.loadPlugin(jsObj(), namespace: "injectedObj")
In the injected object I have a method:
@objc func getPlatform() -> String{
print(" PLARFORNN")
return "{"code":1}"
}
it works and prints on the iOS emulator console.
But it returns undefined in javascript code:
window.injectedObj.getPlatform(); // = undefined
could you give me a clue how can I get result from the method in javascipt in WebView?
Thanx
The text was updated successfully, but these errors were encountered: