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

前端 未结 2 370
感情败类
感情败类 2021-02-01 16:18

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.l

相关标签:
2条回答
  • 2021-02-01 17:00

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

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

    0 讨论(0)
  • 2021-02-01 17:09

    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

    0 讨论(0)
提交回复
热议问题