如何查看Xcode中PhoneGap应用程序的JavaScript错误? [英] How to see the javascript errors of PhoneGap app in Xcode?

查看:144
本文介绍了如何查看Xcode中PhoneGap应用程序的JavaScript错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Xcode中调试我的PhoneGap应用程序,但其控制台无法显示javascript错误。

I want to debug my PhoneGap app in Xcode, but its Console can not show javascript errors.

推荐答案

查看和调试您的Cordova / PhoneGap应用程序中的JavaScript错误的方式是通过将Web检查器从Safari浏览器附加到您的iOS应用程序中的Web视图(但像Tom Clarkson已经提到,您将至少需要iOS 6)。

The most elegant way to view and debug JavaScript errors in your Cordova/PhoneGap App is by attaching the Web Inspector from your Safari browser to the Web View in your iOS App (but, like Tom Clarkson already mentioned, you will need at least iOS 6).


  • 在iPad或iPhone上使用设置应用在Safari的高级设置中启用Web检查器

  • 通过USB将设备连接到Mac(它会显示在Safari的开发菜单下)

  • 启动您的应用程序

  • 要调试的视图

  • 在Mac上,从Safari开发菜单中,从其子菜单中选择设备名称和应用程序(其HTML页面)

  • 将打开Web检查器窗口,您可以浏览DOM,设置断点等。

  • On your iPad or iPhone use the Settings App to enable Web Inspector in the Advanced Settings for Safari
  • Connect your device to a Mac via USB (it will then appear under the Develop menu of Safari)
  • Start your App
  • Navigate to the Web View you want to debug
  • On the Mac, from the Safari Develop menu, select the name of your device and the App (its HTML-page), from its sub menu
  • A Web Inspector window will open, enabling you to browse the DOM, set breakpoints etc.

苹果文档对此进行设置: https:// developer .apple.com / library / content / documentation / AppleApplications / Conceptual / Safari_Developer_Guide / GettingStarted / GettingStarted.html

Apples documentation on setting this up: https://developer.apple.com/library/content/documentation/AppleApplications/Conceptual/Safari_Developer_Guide/GettingStarted/GettingStarted.html

完整的第三方教程:

http://webdesign.tutsplus.com/tutorials/workflow-tutorials/quick-tip-using-web-inspector-to-debug-mobile-safari/

或者,您可以在安装调试代理后将Chrome的网络检查器连接到iOS设备: https://github.com/google/ios-webkit-debug-proxy/ 。这也打开了从Linux进行检查的能力。甚至可以从Windows使用专用Chrome代理远程访问iOS的HTML,CSS和JavaScript: https://github.com/artygus/ios-webkit-debug-proxy-win32

Alternatively you could connect Chrome’s Web Inspector to iOS devices after installing a debug proxy: https://github.com/google/ios-webkit-debug-proxy/. This also opens up the ability to do the inspection from Linux. Remote access to your iOS’s HTML, CSS and JavaScript is even possible from Windows with a dedicated Chrome proxy: https://github.com/artygus/ios-webkit-debug-proxy-win32.

对于每个iOS版本,您需要使用特定的最低版本的Desktop Safari才能使用远程Web检查,请参阅

For each version of iOS you will need a specific minimum version of Desktop Safari in order to use remote web inspection, see the list below.

这篇关于如何查看Xcode中PhoneGap应用程序的JavaScript错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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