Got the "Error launching application on" after flutter run

Viewed 5555

I am flowing the official tutorial to install flutter and run the default app on my iPhone Device. After I execute the flutter run, the app is installed and launched on my iPhone but the logs show the bellow error. How do I solve it?

Launching lib/main.dart on My iPhone 6 in debug mode...
Automatically signing iOS for device deployment using specified development team
in Xcode project: XXXXXXXXXX
Running Xcode build...                                                  
 └─Compiling, linking, and signing...                        50.2s
Xcode builds done.                                           90.1s
Installing and launching...                                        41.1s
Error launching the application on My iPhone 6. <-- Error Here
4 Answers

It happens that there are some process needed to Flutter plugin correctly run on physical devices. I struggled with that and finally found that the processes idevicesyslog and iproxy were being silently blocked by MacOS. You may have noticed already a message liked this:

Mac suggesting to remove iproxy

or a similar one for idevicesyslog.

Once I went to System Preferences -> Security & Privacy in General tab and allowed this apps, everything works. Note that this screen shows only the last app that you tried to run. So I'd recommend that you run flutter app with preferences opened so you can (hopefully) see the messages appearing and click allow.

Option to allow the app. Here it should show one of those 2 names above at a time

MacOS may warn you one more time about the file being downloaded from the internet. Just click open and you're good.

The error do not show again after reboot the iPhone.

Same error -- Running fine through Xcode, when I ran with flutter CLI, the app would open, but the terminal log output would crash with the error as in the post.

I ran flutter update and simultaneously turned iPhone off and back on. After doing that, the below popup appeared (on mac).

A software update is required to connect to iPhone

I believe after the install finished, I ran the below (which I ran several times before updating flutter and installing the popup):

flutter clean
rm -rf ios/Pods
flutter pub get
cd ios && pod install && cd ..

run the flutter app using flutter run from command line, then the MacBook will ask for permission to open the app and app runs,

Related