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

后端 未结 10 1257
轮回少年
轮回少年 2020-12-04 15:12

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

10条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-04 15:41

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

    
    

    However, unless you have the cordova plugin installed, it wont show on XCodes "console". Go to your project folder and type this:

    ? cordova plugin add cordova-plugin-console
    

    This will allow the javascript command 'console.log('some string') to show on XCode.

    Note you will need git, etc... but if you are editing your phonegap project in xcode, you will most probably have it!

    PS Make sure you put the cordova.js script plug-in before any use of console.log

    
    

提交回复
热议问题