Reputation: 77
I want ti evaluateJavaScript()
which is a function from WKWebView
I get the error with detail is:
Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}
Can any one met this problem? Hope to your share.Thanks!
Upvotes: 0
Views: 102
Reputation: 761
You can check the JavaScriptCore framework to evaluate JavaScript. it is native iOS framework.
let context = JSContext()
let _ = context?.evaluateScript(evaluateScriptJSCode)
let method = context?.objectForKeyedSubscript("methodToCallInJavaScript")
let result = method?.call(withArguments: [params])
Upvotes: 1