如何使用Cordova和ios模拟器调试js代码? [英] How can I debug js code using Cordova and ios simulator?

查看:125
本文介绍了如何使用Cordova和ios模拟器调试js代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用xcode 4.5.2和PhoneGap(Cordova)开发iphone应用.

I am using xcode 4.5.2 and PhoneGap (Cordova) to develop an iphone app.

在xcode中查看Log Navigator不会向我显示任何js console.log.

Looking at the Log Navigator in xcode does not show me any of the js console.logs.

我应该怎么做才能看到这些日志输出?

What must I do to be able to see these log outputs?

推荐答案

这可能会有点晚,但是非常简单.

This may be a little late but its quite simple.

因此在Safari中,转到preferences-> advanced-> Show Develop menu in menu bar.完成后,在xcode中构建并运行,然后在safari中运行Develop-> iPhone Simulator-> Your App Name.

So in Safari, Go preferences -> advanced -> Show Develop menu in menu bar. Once you've that, build and run in xcode and then in safari go Develop -> iPhone Simulator -> Your App Name.

它工作得很好,但是我找不到使它持久的方法,因此您似乎需要在每次运行后重复一次,这很痛苦.如果我找到方法,请在这里发布.

It works pretty well but I can't find a way to make it persist as such, so you need to repeat this after every run seemingly, which is a pain. If I find a way I'll post here.

其他:

正如Harry在下面的注释中指出的那样,您可以随后在野生动物园控制台中运行location.reload以重新加载Cordova应用并查看该应用启动时的所有日志消息

As Harry points out below in the comments, you can then run location.reload in the safari console to reload the Cordova app and see all the log messages from the boot of the application

这篇关于如何使用Cordova和ios模拟器调试js代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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