PhoneGap帮助:设备属性,cordova v phonegap,xcode调试 [英] PhoneGap Help: device properties, cordova v phonegap, xcode debugging

查看:72
本文介绍了PhoneGap帮助:设备属性,cordova v phonegap,xcode调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今晚才刚开始使用Phonegap,我喜欢它!但是我有几个问题.

I just started playing around with Phonegap tonight, and I love it! But I'm having a few issues.

在他们的网站上,有两种不同的安装过程:此处列出了一种: http://phonegap.com/install/,另一个列在此处:

On their website, there's two different installation procedures: one is listed here: http://phonegap.com/install/, and the other is listed here: http://docs.phonegap.com/en/3.0.0/guide_cli_index.md.html#The%20Command-line%20Interface

我看到的许多示例也有所不同,有些示例在HTML文件中引用phonegap.js,而其他示例在HTML文件中使用cordova.js.这两个安装和这两个JS文件之间有什么区别?

There is also a difference in many of the examples I see, with some referencing phonegap.js in the HTML file, and others using cordova.js in the HTML files. What is the difference between these two installations, and these two JS files?

接下来,每当我尝试获取任何设备属性时,都不会发生任何事情(我假设正在抛出错误,因为不会执行任何其他代码).例如,如果我执行"document.write(device.name)",我什么也没得到,但是如果我执行"document.write('test')",它将正常工作

Next, whenever I try to get any of the device properties, nothing happens (I'm assuming an error is being thrown, because no other code will execute). For example, if I do "document.write(device.name)" I get nothing, but if I do "document.write('test')" it works fine

最后,对于"phonegap"版本,我正在运行phonegap build ios,然后进入打开项目的xcode,然后单击运行".每当我做console.log时,我都希望我能在xcode调试窗口中看到输出,但是那没有发生.有什么方法可以将控制台(和错误)消息发送到xcode控制台吗?

Finally, for the "phonegap" version, I'm running phonegap build ios, then I go into xcode where the project is open, and I click Run. Whenever I do console.log, I was hoping that I would see the output in the xcode debug window, but that's not happening. Is there any way to send console (and error) messages to the xcode console?

谢谢!

推荐答案

我认为您可能需要做的(如果尚未安装)是首先安装必要的插件.要访问设备API,请安装此插件:

I think what you may need to do (if you haven't already) is to install the necessary plugins first. To access the device API, install this plugin:

 $ phonegap plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git

要启用调试控制台,请安装此插件:

To enable the debug console, install this plugin:

$ phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git

如果您正在开发一项cordova项目,我认为您可以在上面的代码中将"phonegap"替换为"cordova".

If you're working on a cordova project, I think you can just replace "phonegap" with "cordova" in the code above.

我遇到了类似的问题,console.log()在xcode中不起作用,一旦安装了插件,它便开始为我工作.提示:在安装这些插件之前,请考虑退出xcode.然后将其打开并旋转一下.不知道这是否重要,但我这样做是为了安全起见.

I ran into similar issues with console.log() not working in xcode, and once I installed the plugin... it started working for me. One tip: considering quitting out of xcode before you install these plugins. Then open it back up and give it a whirl. Not sure if this matters or not, but I did this to play things safe.

这篇关于PhoneGap帮助:设备属性,cordova v phonegap,xcode调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆