how to see phonegap javascript log messages on xco

2019-02-05 15:36发布

I am trying to develop a basic hello world application with phonegap on Xcode. But i can not see the log messages on Xcode console. I have tried console.log and debug.log but they did not worked for me?

How can i see javascript log messages on xcode console?

10条回答
虎瘦雄心在
2楼-- · 2019-02-05 16:14

In later versions of phonegap/cordova, to add the debug console plugin in your project:

cordova plugin add org.apache.cordova.console

查看更多
萌系小妹纸
3楼-- · 2019-02-05 16:18

In my case, i just needed to comment the following lines in the cordova.js :

if(typeof window.console === "undefined") { window.console = { log:function(){} };

查看更多
戒情不戒烟
4楼-- · 2019-02-05 16:22

Problem

The following or a similar error message occurs when adding the console plugin to the ios platform (or after reinstalling) via Command-line Interface:

"CDVPlugin class CDVLogger (pluginName: Console) does not exist."

Solution

Open your Xcode project and go to the tab "Build Phases". Now open the drop-down named "Compile Sources". Click on the "+" sign at the end of the list and add "CDVLogger.m" or any other missing source.

查看更多
疯言疯语
5楼-- · 2019-02-05 16:24
  1. On your real iDevice or in iOS simulator go to Settings > Safari > Advanced and turn on Web Inspector.
  2. Desktop Safari: Safari > Preferences > Advanced and select the Show develop menu in menu bar checkbox.
  3. Now that you have either iOS Simulator open or your iDevice connected to your mac start using web inspector on your website: On your mac, open Safari and go to Develop
查看更多
登录 后发表回答