Printing to console when implementing a single Flutter page in iOS app? - ios

What I am trying to do:
I am working on an app that is currently written in native iOS and Android (Swift and Kotlin). We are wanting to gradually migrate these two apps into one code base via replacing individual native app pages with Flutter pages until we have a full Flutter app. When building the current, mostly Swift project on Xcode, the iOS app is using FlutterEngines to present individual Flutter pages and the Dart and Swift files are communicating via MethodChannels.
I am wanting to print to the console from within the Dart file of the individual Flutter page that is displayed in my iOS app.
What I've tried:
I've tried printing to the console by making use of the print() and log() methods in my Dart files. I've also tried running flutter attach from the terminal while running the iOS project in question and am successfully attaching to the app (I'm able to hot restart/reload), but my Dart files are still not printing to the console. What methods have you all used to print to the console from Dart files being accessed in an iOS project via FlutterEngine?

I have always used Print() to print to the console.
Maybe there is some issues with the data to be printed.
Just an opinion, I may be wrong.

Related

Getting IOS console from Capacitor

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.

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.

How to debug `native Objective C code` in react-native?

I'm using react native in my ios project. I can see all the logs from react native side in chrome console, and some auto generated logs in xcode.
I recently ran into a problem while using Firebase dynamic links in my app. There is a native module LinkManager which basically handles all the dynamic links to the app and sends the parsed url or the deeplink to my app.
But this is not working and I understood that the problem is inside the native module that handles it.
But when I try to give NSLogs, no output appears in the xcode console, nor in the simulator console(cmd + /). I'm wondering how can I debug the native code inside xcode.
You need to open your project in xCode and run it in any simulator. Then you can either add breakpoints on the desired line of code or use NSLogs to degug it or if it is crashing at a particular point, you can add a exception breakpoint in project.
If you want to see logs from native code in XCode debug together with your console.log from JS code, you can do it like this:
#import <React/RCTLog.h>
RCTLog(#"Hello world");

How to identify iOS app extension crash in Xamarin.iOS?

In my Xamarin project, I have added a new app extension project to the solution.
It is running fine with it's auto generated default code. But when I change something in the MainInterface.storyboard and run again, the extension is not loading; it's crashing with a blink.
I am trying to find the reason for the crash. Since debugging extensions with Xamarin Studio is not possible at the moment, how can I detect the reason for the crash?
You have to use old-school way of debugging things for now, using NSLog or Console.WriteLine
These logs will show up in the Device Log pad in the Xamarin Studio or in System logs if you're testing extensions on simulator

How to generate native Xcode Project with specific template automatically ?( Example :Dapp - app maker)

I am trying to make new mac app, using this app we can select the rough flow of an iOS app and we can also select the UI elements that we need in app and if we are pressing generate button , it will generate xcode project with the specific work flow that we passed in mac app.
Its my idea. Can anyone tell me the possibilty of genarating xcode project with specific template automaticcally using any tools ?

Resources