【问题标题】:Cordova Diagnostic plugin does nothingCordova 诊断插件什么都不做
【发布时间】:2019-02-01 15:44:06
【问题描述】:

这是我的第一个 cordova 应用程序,我正在尝试使用 cordova.plugins.diagnostic 插件。我相信我已经正确安装了它。在设备准备就绪时,我可以提醒您

alert(cordova.plugins.diagnostic != null) // returns true

// Appears to do nothing, i get no alerts
cordova.plugins.diagnostic.isLocationEnabled(function(enabled){
    alert(enabled)
}, function(){
    alert("ERROR");
});

我认为我的错误在于我运行应用程序的方式。我通过

构建应用程序
cordova build ios

然后我通过 xCode 9.4 将构建运行到本地 iPhone X

非常感谢任何关于我做错了什么的想法。

【问题讨论】:

    标签: xcode cordova cordova-plugins


    【解决方案1】:

    我找到了问题!原来,运行的时候

    cordova build ios
    

    我会收到并存档未找到的错误,我基本上忽略了它,因为它在通过 xCode 构建时似乎没有任何影响。

    我通过运行解决了错误

    cordova build ios --buildFlag="-UseModernBuildSystem=0"
    

    然后,我可以将输出的 .ipa 文件通过

    安装到我的设备上
    Window > Devices and Simulators > {select device} > drag and drop ipa into app list
    

    在此之后运行应用程序允许从 isLocationEnabled 成功响应!

    我希望这个答案对其他人有帮助:D

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-21
      • 2015-10-28
      • 1970-01-01
      • 2018-07-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多