How can I debug js code using Cordova and ios simulator?

狂风中的少年 提交于 2019-12-03 05:39:52

问题


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

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?


回答1:


This may be a little late but its quite simple.

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.

Additional:

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




回答2:


I found a little help to open the console for ios simulator

http://blog.persistent.info/2014/06/adding-keyboard-shortcuts-for.html



来源:https://stackoverflow.com/questions/14506160/how-can-i-debug-js-code-using-cordova-and-ios-simulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!