Reputation: 23
I'm encountering an issue with my Flutter iOS app where, after installing it on a real device (iPhone 13), it runs successfully upon the initial installation using Xcode. However, if I close the app and try to reopen it by tapping on the app icon on the device, it crashes immediately. This behavior is not observed on an older iPhone 6+ running iOS 12, and the app also works fine in the simulator. Even a simple Flutter test template crashes when launched from the device icon, working only when initiated through Xcode's "Run" button.
Upvotes: 2
Views: 964
Reputation: 81
This is expected behavior when running the app in debug mode. Here's what's happening:
1. When running through Xcode/Android Studio in debug mode:
Solution: 1. Run the app in Profile or Release mode instead:
2. After installing in Profile/Release mode:
This is not a bug but rather the expected behavior of debug builds, which are not meant for standalone operation outside of the development environment.
Upvotes: 0
Reputation: 6813
When running your flutter app to a device via xcode (assuming you have completed all the xcode setup, certificates, etc), you should use the following command from your flutter project directory:
flutter run --profile -d 'YOUR_DEVICE'
(Use 'flutter devices' if you need to see the connected devices)
Upvotes: 1
Reputation: 1
"To launch in debug mode in iOS 14+, run flutter run from Flutter tools, run from an IDE with a Flutter IDE plugin or run the iOS project from Xcode. Alternatively profile and release mode apps can be launched from the home screen." github issues
Upvotes: 0