Getting IOS console from Capacitor - ios

Does anyone know how to view console.log() from the Xcode simulator using capacitor? I am aware that you can view the system logs via iOS Simulator > Menu Bar > Debug > Open System Log (How can I get the console logs from the iOS Simulator?), but this does not show any of the console.logs when using capacitor to run an ios application.

I couldn't get the Ionic instructions to give any output via Safari's dev tools.
However, Capacitor's solution is its built-in Console API https://capacitorjs.com/docs/v2/apis/console
The Console API automatically sends console.debug, console.error,
console.info, console.log, console.trace and console.warn calls to the
native log system on each respective platform. This enables, for
example, console.log calls to be rendered in the Xcode and Android
Studio log windows.
I was able to see the logs in Xcode's logging as long as the build isnt broken in some way.

Related

Flutter App freezes in native Splash/Loading-Screen

I and my team have a really frustrating problem for weeks now.
Problem in short
The newest version of our flutter app wrapped again by Citrix MDX is not able to continue running beyond its native implemented Splash Screen. It does not crash.
How I got there
I shipped a Flutter app as an IPA file build with Flutter 1.17.5. The file itself can be installed on any iOS device and runs fine. The IPA-file-receiver tried the same and it runs fine too.
The IPA-receiver wraps&signs the app again with his provisioning profile and certificate using Citrix MDX (Version > 20.x). Only the local MDX tool via command-line (not the online) is able to wrap the app. The log file from the MDX tool does not contain any errors.
The wrapped-app can be installed on their iOS devices and run.
Result: The native Splash-Screen is shown and that's it. The app does not continue to show the first Flutter view nor does it crash or close itself.
Unfortunately, we have no OS logs from the running app and also we don't have the wrapped-app from the MDX tool.
What makes me wonder: ...is that the wrapped app from MDX works on iOS tablets after changing its orientation this will somehow trigger Flutter to load its first view.
What we already did
try-catch'ed the main-Method and provided a Flutter-Screen with some Error-Output capability. Result: The error screen showed that some plugin we are using via pubspec was missing. However, the MDX tool logs showed that the plugin was there. Worth mentioning: The error screen did not showed up in our latest test, the app was just somehow freezing in its native Splash-Screen again.
Searching for any changes since the last release that was running fine.
Is there anyone who has some idea worth trying out or some hint where you would start searching for the problem?
Help is much appreciated and sorry for not having some re-produceable steps.

Ionic 2 app safari remote debugger disconnects immediately

I am trying to debug an application written in Ionic 2 (Angular 2) on device via Safari remote dev tools. When the app is open and I connect the iphone to the Mac it shows up under Safari > Develop menu, but as soon as I connect to it (and the dev tools do show up) it disappears from the Safari > Develop menu and in the just opened dev tools I am unable to execute anything in the console nor expand any node in the Elements panel.
When I unplug and replug the device it shows up in Safari > Develop again but the devtools window is gone, and as soon as I open it up again... Same thing.
Any help?
You wouldn't believe what solved the issue....
Running Safari.app through terminal by executing /Applications/Safari.app/Contents/MacOS/Safari it opened up Safari as usual, but for some strange reason it didn't disconnect my device when connecting to it via remote dev tools.
I finally managed to get it working in two steps :
First I used to get some debugging console working using ios-webkit-debug-proxy on a linux machine (https://github.com/google/ios-webkit-debug-proxy) (You need to compile from sources including tools from libimobiledevice to get it working with iOS >= 10)
Then it helped me to notice I had many errors like Refused to load the script 'http://xxxxx' because it violates the following Content Security Policy directive: "connect-src ... that where not occurring while remote debugging with android and chrome. Fixed them by adding the appropriates rules in the <meta http-equiv="Content-Security-Policy" content="..." line in index.html . Don't know exactly which one fixed it but is suspect connect-src wss://s-usc1c-nss-128.firebaseio.com http://my_local_ip:4200 https://maps.googleapis.com ws://*; did the trick

Ionic - view console.log in iOS emulator

I am working on an ionic app for iPad. In order to test the app on Mac, I am using the emulate command
ionic emulate ios
This launches the application in iOS Simulator. However, I am not able to find the console.log that I have printed in the Ionic application. After launching, it prints the following logpath in the terminal. However, the console.log file does not exist in this path
logPath: /Users/kayasa/myIonicApp/platforms/ios/cordova/console.log
Upon some research I found that in order to view the console.log message, emulate command needs to be executed with -lc command. However, this command does not even start the application in Simulator correctly. The application launches with the white blank screen.
Then I also tried launching the app from within xcode itself. It does launch the app in Simulator but I can't find a way to see the console.log here as well.

Xcode not showing logs after exiting the app and come back

I'm using Xcode 6.1 and running an app on the Simulator. When the app exits by double-tap home button, no logs show any more from Xcode console when I come back to the app. Anyone knows what's going on. Appreciate
You need to launch (run) the app from Xcode into the simulator in order to get Xcode's debugger to attach and stream the simulator's console output into the debugger window.
You can also view the Simulator console output by looking at a system log file, details for which can be found in this related question.

Where does the trigger.io forge.logging.log (etc) output go when running on the real device (IOS or Android)?

Where does the trigger.io forge.logging.log (etc) output go when running on the real device (IOS or Android)?
Example,
forge.logging.log('inside my app');
For iOS, the log output is visible in the XCode organiser: click on Console under your device on the left sidebar.
For Android, if you started the app on the device using forge run android the output is piped into your terminal. If you didn't start the app from our tooling, the log output is still available: run adb logcat in a terminal.
In both cases, make sure you have your logging module configured properly. If you have the level set to ERROR, debug level messages will not appear!

Resources