gpt4 book ai didi

android - PhoneGap : diagnostic plugin is not working in iphone

转载 作者:行者123 更新时间:2023-11-28 21:32:28 24 4
gpt4 key购买 nike

我正在尝试在由 phonegap Build 构建的 ios 应用程序中使用诊断插件。它在 android 上工作正常,但在 ios 上不工作。

它在远程调试(控制台)中没有显示任何错误。

我正在使用以下两个文件来构建此应用:

index.html

<!DOCTYPE html>
<html>
<head>
<title>Using PhoneGap Audio Media</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-type">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">

<script src='cordova.js'></script>

<script type="text/javascript">
function onDeviceReady() {

cordova.plugins.diagnostic.isLocationEnabledSetting(function(enabled){
if(enabled)
{
alert("Location Setting is enabled");
}
else
{
alert("Location Setting is disabled");
}
}, function(error){
alert("The following error occurred: "+error);
});
}
document.addEventListener("deviceready", onDeviceReady, false);
</script>

</head>

<body>
Checking...
</body>
</html>

config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.phonegap.location" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
<name>Location Tester</name>
<description>
Hello World sample application that responds to the deviceready event.
</description>
<author email="support@phonegap.com" href="http://phonegap.com">
PhoneGap Team
</author>

<gap:platform name="ios" />
<gap:platform name="android" />
<gap:platform name="winphone" />
<preference name="android-build-tool" value="gradle" />

<preference name="orientation" value="default" />
<preference name="fullscreen" value="true" />
<preference name="permissions" value="none" />
<preference name="target-device" value="universal" />
<preference name="webviewbounce" value="true" />
<preference name="prerendered-icon" value="true" />
<preference name="stay-in-webview" value="false" />
<preference name="ios-statusbarstyle" value="black-opaque" />
<preference name="detect-data-types" value="true" />
<preference name="exit-on-suspend" value="false" />
<preference name="show-splash-screen-spinner" value="true" />
<preference name="auto-hide-splash-screen" value="true" />
<preference name="disable-cursor" value="false" />
<preference name="android-minSdkVersion" value="14" />
<preference name="android-installLocation" value="auto" />
<gap:plugin name="cordova-plugin-flashlight" source="npm" />
<gap:plugin name="cordova-plugin-request-location-accuracy" source="npm" />

<gap:plugin name="com.phonegap.plugins.barcodescanner" />
<gap:plugin name="org.apache.cordova.battery-status" />
<gap:plugin name="org.apache.cordova.camera" />
<gap:plugin name="org.apache.cordova.media-capture" />
<gap:plugin name="org.apache.cordova.console" />
<gap:plugin name="org.apache.cordova.contacts" />
<gap:plugin name="org.apache.cordova.device" />
<gap:plugin name="org.apache.cordova.device-motion" />
<gap:plugin name="org.apache.cordova.device-orientation" />
<gap:plugin name="org.apache.cordova.dialogs" />
<gap:plugin name="org.apache.cordova.file" />
<gap:plugin name="org.apache.cordova.file-transfer" />
<gap:plugin name="org.apache.cordova.geolocation" />
<gap:plugin name="org.apache.cordova.globalization" />
<gap:plugin name="org.apache.cordova.inappbrowser" />
<gap:plugin name="org.apache.cordova.media" />
<gap:plugin name="org.apache.cordova.network-information" />
<gap:plugin name="org.apache.cordova.splashscreen" />
<gap:plugin name="org.apache.cordova.vibration" />
<preference name="webviewbounce" value="false" />

<preference name="DisallowOverscroll" value="false" />

<preference name="disallowOverscroll" value="false" />

<preference name="exit-on-suspend" value="true" />

<access origin="*" subdomains="true" />
</widget>

我正在尝试在此应用中使用的插件:https://www.npmjs.com/package/cordova.plugins.diagnostic

我没有收到任何错误。我对这个问题进行了很多研究,但没有白费。非常感谢任何回复。

谢谢

最佳答案

这就是您使用的 config.xml 吗?因为我没有看到任何对 cordova.plugins.diagnostic 的引用在里面。因此,该插件是否实际安装在项目中?

我希望看到 <gap:plugin name="cordova.plugins.diagnostic.api-22" />如果你使用 legacy branch .

<gap:plugin name="cordova.plugins.diagnostic.api" />如果您使用 master 分支针对 Android API 23 构建 Cordova 6.0.0 on Phonegap Build :

<preference name="phonegap-version" value="cli-6.0.0" />

除此之外,您在 index.html 中对 JS API 的使用看起来是正确的。

关于android - PhoneGap : diagnostic plugin is not working in iphone,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35373948/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com