【发布时间】:2021-10-05 13:22:10
【问题描述】:
创建了一个测试应用程序flutter create hello_world。
ios 模拟器上的flutter run 完美启动了应用程序——它可以工作!
但是在真正的iOS设备上启动时,会出现“本地网络”窗口->按“允许”,然后只有白屏。
iOS 14.7.1
Xcode 12.5.1
签名和功能 - 没有错误
flutter doctor -v
颤振医生 -v [✓] Flutter (Channel stable, 2.2.3, on macOS 11.5 20G71 darwin-x64, locale 茹-茹) • Flutter 2.2.3 版,位于 /Users/incognito/Developer/flutter • 框架修订 f4abaa0735(4 周前),2021-07-01 12:46:11 -0700 • 引擎版本 241c87ad80 • Dart 版本 2.13.4
[✓] Android 工具链 - 为 Android 设备开发(Android SDK 版本 31.0.0) • Android SDK 位于 /Users/incognito/Library/Android/sdk • 平台 android-31,构建工具 31.0.0 • Java 二进制文件位于:/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java 版 OpenJDK 运行时环境(内部版本 11.0.8+10-b944.6916264) • 接受所有 Android 许可证。
[✓] Xcode - 为 iOS 和 macOS 开发 • Xcode 位于 /Applications/Xcode.app/Contents/Developer • Xcode 12.5.1,内部版本 12E507 • CocoaPods 版本 1.10.1
[✓] Chrome - 为网络开发 • Chrome 位于 /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio(4.2版) • Android Studio 位于 /Applications/Android Studio.app/Contents • Flutter 插件可以从以下位置安装: ??? https://plugins.jetbrains.com/plugin/9212-flutter • Dart 插件可以从以下位置安装: ??? https://plugins.jetbrains.com/plugin/6351-dart • Java 版 OpenJDK 运行时环境(内部版本 11.0.8+10-b944.6916264)
[✓] 已连接设备(2 个可用) • iPhone 12 mini(移动) • 1CE9DEC7-D645-4C14-A3A5-79C4B1C8AB9F • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-5(模拟器) • 铬(网络) • 铬 • web-javascript • 谷歌浏览器 92.0.4515.107 !错误:iPhone No Name is busy:Waiting for Device。 Xcode 将继续 当 iPhone No Name 完成时。 (代码-10)
Xcode 控制台
2021-07-30 01:27:14.959824+0300 Runner[440:12621] Metal API Validation Enabled
2021-07-30 01:27:15.028878+0300 Runner[440:12621] fopen failed for data file: errno = 2 (No such file or directory)
2021-07-30 01:27:15.028922+0300 Runner[440:12621] Errors found! Invalidating cache...
2021-07-30 01:27:15.076411+0300 Runner[440:12621] Warning: Unable to create restoration in progress marker file
2021-07-30 01:27:15.088662+0300 Runner[440:12868] [VERBOSE-2:shell.cc(93)] Dart Error: Can't load Kernel binary: Invalid kernel binary format version.
2021-07-30 01:27:15.088704+0300 Runner[440:12868] [VERBOSE-2:dart_isolate.cc(170)] Could not prepare isolate.
2021-07-30 01:27:15.088835+0300 Runner[440:12868] [VERBOSE-2:runtime_controller.cc(382)] Could not create root isolate.
2021-07-30 01:27:15.088861+0300 Runner[440:12868] [VERBOSE-2:shell.cc(576)] Could not launch engine with configuration.
2021-07-30 01:27:15.115109+0300 Runner[440:12882] flutter: Observatory listening on http://127.0.0.1:50825/Ibq99VrylBU=/
更新
后遗症的足迹: 解决方法——删除你Flutter安装目录下的bin/cache目录,然后运行flutter doctor再试一次。
【问题讨论】:
-
卸载并重新运行您的应用
-
“卸载并重新运行应用程序”是什么意思?我新建了一个(比如hello world)应用,启动现成的,结果是一样的
-
在 Flutter 项目目录中运行
flutter build ios为我解决了这个问题。