Cordova 诊断插件什么都不做

Cordova Diagnostic plugin does nothing

这是我的第一个 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

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

我找到问题了!本来,当 运行

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