Hi I'm trying to implement XWebView in my project by following the sample code. And I'm trying to pass a image file in base64 format from swift back to the webview and display it on html. I tried to follow the example given in #52 but I'm getting this error:
TypeError: window.HelloWorld.imageSource is not a function. (In 'window.HelloWorld.imageSource(function(result){ document.getElementById("img0").src = result;})', 'window.HelloWorld.imageSource' is undefined)
My swift code looks like this:
func imageSource(callback: XWVScriptObject) {
print(" PLARFORNN")
callback.call(arguments: [strBase64], completionHandler: { result, error in
print("Completed Javascript evaluation.")
print("Result: \(result)")
print("Error: \(error)")
})
}
And my javascript looks like this:
window.HelloWorld.imageSource(function(result){
document.getElementById("img0").src = result;
});
I'm not too sure which part I did it wrongly.
Hi I'm trying to implement XWebView in my project by following the sample code. And I'm trying to pass a image file in base64 format from swift back to the webview and display it on html. I tried to follow the example given in #52 but I'm getting this error:
My swift code looks like this:
And my javascript looks like this:
I'm not too sure which part I did it wrongly.