0

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!

4

1 回答 1

1

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])

于 2018-02-02T05:02:54.243 回答