Home > Mobile >  Flutter Plugin - Example App - Only runs via Xcode, not by itself
Flutter Plugin - Example App - Only runs via Xcode, not by itself

Time:09-15

I'm creating a flutter plugin and I just tried the example project that gets created by flutter it self. This example project is an app that shows the operation system and its version. If I start it from Xcode on my iPhone SE, it works fine. But if I close the app and open it without Xcode, that means that I tipp on the app icon to launche it, like every normal app, it doesn't start correctly. It is showing for not even a second a white screen, followed by a black screen and is closing the app right after this.

  1. Why is it behaving like that?
  2. Is it, because it is a debug version and needs Xcode?
  3. How can I put my example app on my iPhone without needing a connection to Xcode to start it?

Thanks in advance!


Edit: Thanks to the answer of Răzvan Puiu below, i know now that this is because xCode puts the app as a debug version on my iPhone. This debug version can only run with xCode. After I tried it with a 'normal' app and not the example app of a plugin project, i even got this text shown if i tried to start the debug version without xCode: enter image description here

So the solution is to run the app with:

flutter run --release

CodePudding user response:

  1. I believe it behaves like that because you don't have an Apple developer account. "Without enrolling in the Apple Developer Program, your app will only last for 7 days on your device. After that, you’ll have to re-deploy it to your device via Xcode. If you’re enrolled in the Apple Developer Program, you won’t have this inconvenience."
  2. Yes
  3. You can run flutter run --release and then select your physical device. However the app will remain on your phone for only 7 days unless you have the Apple dev account.
  • Related