不能得到phonegap device.platform工作 [英] can't get phonegap device.platform to work
本文介绍了不能得到phonegap device.platform工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用Xcode并尝试获取设备的信息,但它不显示。
这是我的代码
I'm using Xcode and trying to get the device's info, but it's not showing up. 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>
警报(1)弹出,但它只跳过警报(2)和警报(状态)。
我正在使用PhoneGap 3.0,我做错了什么?
alert (1) pop up, but it just skip alert (2) and alert(status). I'm using PhoneGap 3.0,what am I doing wrong?
推荐答案
xml(/config.xml)在你的xcode项目中。查看是否添加了设备插件。
check your plugin tag in your config.xml (/config.xml) in you your xcode project. 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>
这篇关于不能得到phonegap device.platform工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文