Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/117.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 与iOS客户端的JS通信_Javascript_Ios_Swift_Communication - Fatal编程技术网

Javascript 与iOS客户端的JS通信

Javascript 与iOS客户端的JS通信,javascript,ios,swift,communication,Javascript,Ios,Swift,Communication,我有一个js页面,与现有的android客户端对话 JS代码: export function sendData(data: Array<String>, callback: String) { if (window.androidClient) { window.androidClient.sendData(data, callback); } else if (window[callback) { //processing callbac

我有一个js页面,与现有的android客户端对话

JS代码:

export function sendData(data: Array<String>, callback: String) {
    if (window.androidClient) {
       window.androidClient.sendData(data, callback);
    } else if (window[callback) {
      //processing callbackData
    }
}
导出函数sendData(数据:数组,回调:字符串){ if(window.androidClient){ window.androidClient.sendData(数据,回调); }else if(窗口[回调]{ //处理回调数据 } } 我还想使用现有的代码与iOS对话

如果我们正在使用WKWebKit,我可以看到一些文章建议使用它

webkit.messageHandlers.<myHandler>.postMessage()
webkit.messageHandlers..postMessage()
有没有什么方法可以实现iOS而不做任何更改是js代码。 如有任何提示/代码,我们将不胜感激

谢谢