在iOS上调试Cordova(PhoneGap)代码 [英] Debugging Cordova (PhoneGap) code on iOS

查看:269
本文介绍了在iOS上调试Cordova(PhoneGap)代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用通过Cordova(PhoneGap)在iOS中托管的应用程序。我遇到了一些问题,当我尝试访问device.platform和device.version属性。我不知道什么问题是。无论如何,我不知道如何窥视代码,以更好地了解发生了什么。

I'm working on an app I want to host in iOS via Cordova (PhoneGap). I've run into some problem when I try to access the device.platform and device.version properties. I'm not sure what the problem is. Either way, I can't figure out how to peek into the code to get a better idea of what's going on.

我想我可以只是启动.html在Safari的桌面版本,但是,这没有提供任何见解。总之:

I thought I could just fire up the .html in the desktop version of Safari, however, that didn't provide any insights. In short:


  1. 如何调试Cordova内部运行的代码?

  2. 不能只是执行alert(device.platform);?

谢谢!

推荐答案

从iOS 6开始,您只需在Safari中启用开发菜单,然后使用 Safari Web Inspector 在iOS模拟器或USB连接设备中远程调试Cordova应用程序。如果您已经使用过Chrome浏览器的调试器,您会感觉很舒服。

Since iOS 6 you can just enable the Develop menu in Safari and use Safari Web Inspector to remotely debug Cordova app in either iOS Simulator or USB attached devices. If you've used Chrome's debugger you'll feel right at home.

这篇关于在iOS上调试Cordova(PhoneGap)代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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