This is the 27th day of my participation in Gwen Challenge

preface

Some time ago, when I was developing a Flutter related App, MY iPhone was connected to my Mac, and then I ran VS Code to start the Flutter program. The Flutter could be normally installed on my mobile phone. However, after the installation, I updated the system of my mobile phone, and the system was updated to the latest iOS 14.4. Then re-open the Flutter application installed in the mobile phone and encounter startup problems. This article will analyze the specific causes and solutions.

An error prompt

After update to iOS 14.4, run the Flutter application installed on your mobile phone. The application does not start and the following message is displayed:

    In iOS 14+,debug mode Flutter apps can only be launched from Flutter tooling, IDEs with Flutter plugins or from Xcode.
    Alternatively,build in profile or release modes to enable launching from the home screen.
Copy the code

Analysis of the

First of all, let’s analyze the above error in English, translate it directly, the meaning of translation is as follows: In iOS 14+, Flutter applications in debug mode can only be launched from within the Flutter tool. IDEs (including VS Code and Android Studio) has the Flutter plugin or Xcode launched. Alternatively, build with configuration files or use release mode to enable booting from the home screen.

Error reason

In Debug mode, the hot reload of Flutter changes the default compilation mode to JIT. However, since iOS 14, Apple has restricted the JIT compilation mode, which causes the App based on Flutter to not run in debug mode.

After the analysis of

After analyzing the text of the above prompts, there are two solutions to the above error problem.

Matters needing attention

Open the Flutter application directly with XCode, directly open the Settings of XCode, change the compilation mode to Release mode, then reconnect the phone and run the application. After the application is successfully run, disconnect the phone and open the application in the phone again. The Flutter application can run normally.

However, if you run the project with Xcode12 and connect your phone to install the Flutter application, then disconnect your phone from your computer and open the application installed on your phone again, it will flash back, so this method will not work.

Solving steps

There are two ways to resolve the error message. One is to use the release mode of Flutter directly, and the other is to use the profile directly.

Method one:

To resolve this error, use the release mode of Flutter directly. Enter the command line directly into the terminal that starts the project: Flutter run — Release enter to run the Release mode of Flutter, then disconnect your phone from your computer and open the Flutter application installed on your phone again without blinking back.

Method 2:

Find the location of the Flutter files installed on the computer, directly find the Flutter /packages/ Flutter_tools /bin/xcode_backend.sh file, directly set the compilation mode of Flutter to release mode, and then connect the phone to the computer again to run the program. Then disconnect the computer and open the app installed on the phone again to open and run the program without blinking back.

The last

Method one is recommended to solve this problem, conveniently using the command line flutter run –release. The above is all the content of this chapter. Welcome to pay attention to the wechat public account of Sanzhan “Program Ape by Sanzhan”, and the Sina Weibo account of Sanzhan “Sanzhan 666”, welcome to pay attention!