How to see the javascript errors of PhoneGap app in Xcode?

By : mockee
Source: Stackoverflow.com
Question!

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

By : mockee


Answers

Here's a simple way that worked for me:

  • cd to the directory containing your index.html file in the terminal
  • Start a http server using python by invoking (I used python 2.7):

    python -m SimpleHTTPServer

  • View the page in safari by entering the address of the HTTPServer in a browser, for me the URL was:

    http://0.0.0.0:8000/
    
  • Open developer tools:

    In chrome this is alt command i. View the console tab, may need to refresh the page.

    In Safari: Safari --> Preferences --> Advanced --> check "Show Develop Menu". Develop menu --> Show error console (or alt command c). Refresh the page. Hitting CTRL 5 opens the issues tab.



Put this in the beginning of your index.html

By : Toolkit


To view all errors in javascript console, I agree to use this event listener



This video can help you solving your question :)
By: admin