iOS PhoneGap调试工作流 [英] iOS PhoneGap debug Workflow

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

问题描述

如何在Xcode中调试JavaScript?

How do you debug javascript in Xcode?

我可以做的一件事是在OS X Chrome浏览器中打开页面,但自然不适用于应用程序涉及本地代码的流。有没有一个聪明的Xcode欺骗,我失踪。

One thing that I can do is open the page in OS X Chrome browser, but naturally this will not work for application flow involving native code. Is there a smart Xcode trick that I am missing.

推荐答案

随着iOS 6的发布,Apple与Mac Safari 6一起发布了用于其Mobile Safari的远程Web Inspector,是巨大的。基本上,您具有Web Inspector在常规Safari中的所有功能和强大功能,适用于您的移动应用程序,包括Phonegap应用程序。我使用了weinre,这使它在iOS的新版本(但不是旧版本的iOS,非iOS设备,如android,或如果你在Windows上)过时。

With the release of iOS 6, Apple released remote Web Inspector for their Mobile Safari in conjunction with Mac Safari 6, and this is huge. Basically you have all the features and power of Web Inspector in regular Safari, for your mobile apps, including Phonegap apps. I've used weinre and this makes it obsolete for newer versions of iOS (but not for old versions of iOS, non-iOS devices such as android, or if you're on Windows).

以下是它的工作原理(需要Mac,xCode 4.5+运行iOS 6+模拟器或iOS 6+设备,Mac 6上的Safari 6+):

Here's how it works (requires a Mac, either xCode 4.5+ running an iOS 6+ simulator or an iOS 6+ device, and Safari 6+ on your Mac):

在您的ios模拟器或ios设备中,打开设置 - > Safari - >高级 - > Web检查器 - >(打开)。 (这是在模拟器默认启用,但它的价值检查)

in your ios simulator or ios device,open settings --> Safari --> Advanced --> Web Inspector --> (turn On) . (this is on by default in the simulator, but its worth checking)

在Safari中,你已经开始你的phoneGap / cordova应用程序及其加载&运行,从开发菜单访问iPhone模拟器或您的设备。您可以在Safari的高级首选项中启用开发菜单(如果尚未开启)。

In Safari, after you've started your phoneGap/cordova app and its loaded & running, access iPhone Simulator or your device from the Develop menu. You can enable Develop menu in Safari's Advanced Preferences, if its not already.

底部的更多讨论:
http://www.mobilexweb.com/blog/iphone-5-ios-6-html5-developers

(也,如果你在某处阅读了一个秘密私人接口,这将不再工作了。)

(also, if you read about a "secret private interface" somewhere, this doesn't work anymore.)

这篇关于iOS PhoneGap调试工作流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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