Cordova 2.9, 3.0 no console.log

前端 未结 4 1884
被撕碎了的回忆
被撕碎了的回忆 2021-02-05 06:27

With a fresh download of Cordova 2.9 and the Cordova CLI, I created Hello World application via the CLI. I also added the iOS platform via the CLI. Looking in the index.js file

相关标签:
4条回答
  • 2021-02-05 06:58

    The problem is because of the command line utility. There are two ways to create a project with the PhoneGap/Cordova CLI - Use the bash scripts that come with PhoneGap folder you download, and (2) to install the Cordova CLI.

    I used the Cordova CLI, which doesn't use any resources you download, it downloads the latest release of PG - in this case 3.0, which isn't available yet on phonegap.com. It's very possible it may not be a stable release, because the console.log didn't work in the iOS app it created.

    I tried using the batch script in the 2.9 folder I downloaded, and it created an app with fully functional console.log(ging).

    0 讨论(0)
  • 2021-02-05 07:05

    The console functionality is now implemented as a plugin, which you need to manually add to your project:

    $ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git
    
    0 讨论(0)
  • 2021-02-05 07:05

    This turned out to be a 2 hour long problem for me so I thought I would share the love! I fresh installed Cordova 3.0 and then installed the official console log plugin with

    cordova plugin add cordova-plugin-console

    But I still could not get Safari to show logs by going to

    Safari > Develop > IOS simulator > index.html

    So I opened up Xcode and checked the system log File > New Log Window > system.log

    ...system.log is on the left hand side of the popup under the Files section.

    There I noticed that there was a log reading

    Oct 14 01:12:57 Bens-MacBook-Pro.local ios-sim[37222]: stderrPath:     
    /Users/benconant/Dev/FirstCordovaApp/platforms/ios/cordova/console.log
    

    so I ran

    tail -F /Users/benconant/Dev/FirstCordovaApp/platforms/ios/cordova/console.log
    

    in a new terminal window and boom ... got my logs!

    Still have no idea how to get them from Safari :( Would welcome any hints at how to make that happen. Good luck ... this was/is a ruff one.

    0 讨论(0)
  • 2021-02-05 07:16

    try to add Debug Console plugin to your project by running this command:

    $ cordova plugin add org.apache.cordova.console
    
    0 讨论(0)
提交回复
热议问题