In a Cordova application, any calls to console.{log,warn,error,etc} before connecting Safari's developer tools do not appear in the console. This makes it impossible to debug startup errors. How do I get those messages?
Bonus question: How do I get the WebView to stop on debugger; lines prior to connecting with Safari?
This simple trick can be useful, just open the console in Safari and run:
window.location.reload()
I remember a friend telling me about a way to keep safari web inspector running regardless of whether or not the app is in the foreground or not. I found his article and here are the details -
The first thing to do is to set a global hotkey – steps:
Application Shortcuts
CMD + ALT + I
)index.html
or whatever your cordova’s main
html file isSteps to keep open SWI
Application Shortcuts
Aside from the technique above have you installed this plugin below and inspected logs in Xcode?
cordova plugin add org.apache.cordova.console
Do you use Ripple Emulator? Here is a great post on setting it up.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With