I'm working on a Flutter application. It happened to me more than once (this time, when I add flutter_markdown to the project) that my app works when I run flutter run but when I flutter build and use that for opening the app on my phone, the app gets stuck on the splash screen.

I don't have a traditional iOS app development background, so in these cases, it's very difficult for me to figure out the source of the issues.

I tried Xcode clean, clean build folder, flutter clean, rm -rf ~/.pub-cache, rm -rf /Users/username/Library/Developer/Xcode/DerivedData/Runner-*, none of this helped, so it looks like there is an actual problem with my app and not some caching issue.

How am I supposed to debug this issue?

1 Answers

0
Vince Varga On

In Xcode, open Devices and Simulators (in the Window panel or Shift+Command+2).

Here, you'll see your connected devices.

For debugging what causes your Flutter app to hang on the white splash screen, you can either click on the "View Device Logs" or the "Open console" buttons.

In "View Device Logs", you can see the crashes that occurred on that device. If it's empty, then open your app, see it crash and check again.

In "Open console", you see all logs "real time", so this can also help you debug why your app is unresponsive once built.

Don't forget to select the device that's running the app.

As Flutter developers don't always have experience on both platforms, I want to document it anyway here, in case someone needs it (even if it might be obvious for many).