JS方法
报异常如下
Error Domain=WKErrorDomain Code=4 "发生JavaScript异常" UserInfo={WKJavaScriptExceptionLineNumber=1, WKJavaScriptExceptionMessage=ReferenceError: Can't find variable: onFaceRealName, WKJavaScriptExceptionColumnNumber=52, WKJavaScriptExceptionSourceURL=http://12.12.12/verify/idcard-info.html?token=11292803131658321891878number2&s=1658374061429, NSLocalizedDescription=发生JavaScript异常}
OC调用JS方法
1.没问题
[webview evaluateJavaScript:@"app.onFaceRealName(123)" completionHandler:^(id _Nullable result, NSError * _Nullable error) {}];
2.没问题
[webview evaluateJavaScript:@"app.onFaceRealName('123')" completionHandler:^(id _Nullable result, NSError * _Nullable error) {}];
3.有问题
[webview evaluateJavaScript:@"app.onFaceRealName(uid11292803112345946uuid)" completionHandler:^(id _Nullable result, NSError * _Nullable error) {}];
4.没问题
[webview evaluateJavaScript:@"app.onFaceRealName('uid11292803112345946uuid')" completionHandler:^(id _Nullable result, NSError * _Nullable error) {}];
网友评论