我试图通过传入 JSValue
作为参数来调用 javascript 函数。
func callJavascriptFunction(value: JSValue, context: JSContext) {
context.evaluateScript("functionInJavascript(\(value))")
}
我收到此错误消息:
JS Error: SyntaxError: Unexpected identifier 'Object'. Expected either a closing ']' or a ',' following an array element.
谁能帮我解决这个问题?
最佳答案
刚开始工作:
context.objectForKeyedSubscript("functionInJavascript").callWithArguments([value])
关于ios - 为什么在使用 JSValue 作为参数对 javascript 函数进行 iOS native 调用时出现错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32957577/