在 iOS 模拟器上以发布模式 Flutter 启动应用程序时出现问题

Posted

技术标签:

【中文标题】在 iOS 模拟器上以发布模式 Flutter 启动应用程序时出现问题【英文标题】:Problem launching an app in release mode Flutter on an iOS simulator 【发布时间】:2020-11-18 17:05:47 【问题描述】:

我无法再在模拟器上以发布模式启动我的应用程序。当我输入“flutter run --release” 我收到一条错误消息“iPhone 11 不支持发布模式。”。其他人有同样的问题吗?

【问题讨论】:

你能运行“flutter doctor”命令并粘贴输出吗? @Jeremy 你看到了什么... @chihau @Ruben 我也有同样的问题。 Here's我的flutter doctor -v。看起来不错(我不在此设备上进行 android 开发) 【参考方案1】:

Release模式不支持模拟器,我用真机解决了这个问题。首先使用 USB 数据线连接您的设备,然后选择真实设备:

~/source/third-party/Cruise/ios on  master! ⌚ 12:29:28
$ ~/apps/flutter/bin/flutter run --release
Changing current working directory to: /Users/dolphin/source/third-party/Cruise
Multiple devices found:
sdk gphone x86 arm (mobile)         • emulator-5554                        • android-x86 • Android 11 (API 30) (emulator)
dolphin’s iPad (mobile)             • 00008020-000E78C01EC3002E            • ios         • iOS 14.0
iPhone SE (2nd generation) (mobile) • D233A502-B00B-4FCC-B4D1-91408C88EC81 • ios         • com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)
[0]: sdk gphone x86 arm (emulator-554)
[1]: dolphin’s iPad (00002020-000E88C01ECY002E)
[2]: iPhone SE (2nd generation) (D233A502-B00B-4FCC-B4D1-91408C88EC81)
Please choose one: [0|1|2]: 2
Release mode is not supported by iPhone SE (2nd generation).

~/source/third-party/Cruise/ios on  master! ⌚ 12:46:01
$ ~/apps/flutter/bin/flutter run --release
Changing current working directory to: /Users/dolphin/source/third-party/Cruise
Multiple devices found:
sdk gphone x86 arm (mobile)         • emulator-5554                        • android-x86 • Android 11 (API 30) (emulator)
dolphin’s iPad (mobile)             • 00008020-000E78C01EC3002E            • ios         • iOS 14.0
iPhone SE (2nd generation) (mobile) • D233A502-B00B-4FCC-B4D1-91408C88EC81 • ios         • com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)
[0]: sdk gphone x86 arm (emulator-5554)
[1]: dolphin’s iPad (00008020-000E78C01EC3002E)
[2]: iPhone SE (2nd generation) (D233A502-B00B-4FCC-B4D1-91408C88EC81)
Please choose one: [0|1|2]: 1


Launching lib/main.dart on dolphin’s iPad in release mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: 6JP4P88ZJB
Running pod install...                                              2.1s
Running Xcode build...

 └─Compiling, linking and signing...                        32.7s
Xcode build done.                                           193.4s

【讨论】:

以上是关于在 iOS 模拟器上以发布模式 Flutter 启动应用程序时出现问题的主要内容,如果未能解决你的问题,请参考以下文章

在 iOS 发布模式下构建 Flutter 应用

Realm.js - default.realm 已经在当前线程上以不同的模式打开

Flutter 可以在 kiosk 模式下制作 Application 吗? [关闭]

错误:路径 '/var/.../default.realm' 的领域已经在当前线程上以不同的模式打开

在发布模式下构建后 Flutter Secure Storage 无法正常工作

flutter ios app在testflight模式下显示白屏?