google-api-javascript-客户端未加载 ios

google-api-javascript-client doesn't load on ios

当我尝试在 Apple 设备、移动设备或其他设备上加载 google api 客户端时,它给我一个错误并且从未调用回调。然而,当一个帐户登录时,问题确实消失了。它出现在 chrome 模拟苹果移动设备上,它出现在苹果设备本身,如 iphone 和 macbook。

window._gapiOnLoad = function(){
    alert("Never called on iphone");
}
var script = document.createElement('script');
script.onerror = function (e) {
    alert("Also never called");
};
script.src = 'https://apis.google.com/js/client.js?onload=_gapiOnLoad';
document.body.appendChild(script);

错误:

Uncaught TypeError: t[u] is not a function
at Object.Oa.O.(anonymous function) [as loaded_0] (https://apis.google.com/js/client.js?onload=_gapiOnLoad:14:63)
at https://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.en.54rvJIPTsq0.O/m=client/rt=j/sv=1/d=1/ed=1/am=AQ/rs=AGLTcCPwWRWf9u-Qf5Xp2KlRIyI4hERCSA/cb=gapi.loaded_0:1:15

相关但无帮助且错误:https://github.com/ionic-team/ionic/issues/10669

我的网络应用程序:https://brancher.io

第二次调用脚本似乎可以解决问题。

window._gapiOnLoad = function(){
   alert("Is eventually called"); 
}
window.onerror = (e) => {
    if (e == "Script error." && !gapi.client) {
        loadScript();
    }
}
loadScript()
function loadScript() {
    var script = document.createElement('script');
    script.src = 'https://apis.google.com/js/client.js?onload=_gapiOnLoad';
    document.body.appendChild(script);
}