Debugging Cordova iOS plugin with NSLog, where does it output?

452 Views Asked by At

I followed the tutorial at the Cordova official website to create my first "hello world" program for iOS, and everything went successfully, and I'm able to run the example application in the simulator just fine. What I need is to test, use and if necessary fix an iOS plugin. I installed the plugin and it seems to have installed and works fine.

My problem is simple: I'm trying to output some debugging information from the Objective-C code of the plugin using NSLog(), but I have no idea where that output can be seen.

I am definitely editing the correct .m file (inside the platforms/ios/HelloWorld/Plugins/plugin-name directory), as eg. syntax errors show up and stop the "cordova emulate ios" command from completing successfully. So I'm certain that my NSLog() additions are being compiled in. I'm also certain that the functions in question are being called from the javascript. I just don't know where those messages are being outputted to.

In the simulator I try to select Debug > Open System Log... but nothing of what I'm printing appears there.

When I run "cordova emulate ios", it says "[ios-sim] logPath: /path/to/the/project/platforms/ios/cordova/console.log". However, there is no such file in that directory. (In fact, there is no file named "console.log" anywhere inside the project directory tree.)

1

There are 1 best solutions below

0
Jeremy Huddleston Sequoia On

NSLog logs to the simulated device's logarchive. You must select the simulator device in Console to see that, or you can use the CLI:

xcrun simctl spawn booted log show
xcrun simctl spawn booted log stream
etc...

Check the log command's help and man pages for filtering options.