[英]can't get phonegap device.platform to work
I'm using Xcode and trying to get the device's info, but it's not showing up. 我正在使用Xcode并尝试获取设备的信息,但它没有显示出来。 Here is my code 这是我的代码
<!DOCTYPE html>
<html>
<head>
<title>Device Properties Example</title>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, true);
// device APIs are available
function onDeviceReady() {
alert('1');
var status = device.platform;
alert('2');
alert(status);
$("#deviceProperties").html(status) ;}
</script>
</head>
<body>
<p id="deviceProperties">Loading device properties...</p>
</body>
</html>
alert (1) pop up, but it just skip alert (2) and alert(status). 警报(1)弹出,但它只是跳过警报(2)和警报(状态)。 I'm using PhoneGap 3.0,what am I doing wrong? 我正在使用PhoneGap 3.0,我做错了什么?
steps for installation are at http://docs.phonegap.com/en/3.1.0/cordova_device_device.md.html#Device you need to install plugin (cordova 3+) 安装步骤在http://docs.phonegap.com/en/3.1.0/cordova_device_device.md.html#Device,你需要安装插件(cordova 3+)
cordova plugin add org.apache.cordova.device
IOS shouldnt require any special configuration in config.xml IOS不应该在config.xml中需要任何特殊配置
check your plugin tag in your config.xml (/config.xml) in you your xcode project. 检查你的xcode项目中config.xml(/config.xml)中的插件标签。 See if 'Device' plug-in is added. 查看是否添加了“设备”插件。
<widget>
...
<plugins>
<plugin name="Device" value="CDVDevice" />
<plugin name="Logger" value="CDVLogger" />
<plugin name="Compass" value="CDVLocation" />
<plugin name="Accelerometer" value="CDVAccelerometer" />
<plugin name="Camera" value="CDVCamera" />
<plugin name="NetworkStatus" value="CDVConnection" />
<plugin name="Contacts" value="CDVContacts" />
<plugin name="Debug Console" value="CDVDebugConsole" />
<plugin name="Echo" value="CDVEcho" />
<plugin name="File" value="CDVFile" />
...
</plugins>
</widget>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.