TL;DR
编辑 2020-05-06:我的应用程序从 iOS 13.4 开始正确安装,但一段时间后应用程序在启动时崩溃,我必须重新安装它。我不知道为什么。也许是在 iOS 更新之后?
另请参阅下面的答案:https://stackoverflow.com/a/60013390/1121497 https://stackoverflow.com/a/60013390/1121497
完整问题
我正在尝试运行一个新的 Flutter 应用程序(由flutter create
)在 iOS 设备(iPhone XS)上。
Xcode 成功安装了它,但随后崩溃并显示以下消息:
dyld: Library not loaded: @rpath/Flutter.framework/Flutter
Referenced from: /private/var/containers/Bundle/Application/BA807438-FA5B-4021-B37D-FC437B2C80CA/Runner.app/Runner
Reason: no suitable image found. Did find:
/private/var/containers/Bundle/Application/BA807438-FA5B-4021-B37D-FC437B2C80CA/Runner.app/Frameworks/Flutter.framework/Flutter: code signature invalid for '/private/var/containers/Bundle/Application/BA807438-FA5B-4021-B37D-FC437B2C80CA/Runner.app/Frameworks/Flutter.framework/Flutter'
如果我尝试flutter run
,应用程序也会打开并崩溃。该命令会永远等待:
$ flutter run
Launching lib/main.dart on Ferran Maylinch’s iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: 25D86TPBWG
Running Xcode build...
├─Assembling Flutter resources... 4.3s
└─Compiling, linking and signing... 13.3s
Xcode build done. 21.0s
Installing and launching...
(This is taking an unexpectedly long time.) ⢿
在 Xcode 中,我配置了一个团队(个人团队),并且签名证书(Apple 开发证书)似乎很好,因为我可以在我的设备上安装 Hello world Swift 项目。
Note: 我没有向 Apple Developer Program 帐户付款。在 iOS 设备上运行 Flutter 应用程序是绝对必要的吗?
我已遵循macOS 说明 https://flutter.dev/docs/get-started/install/macos and flutter doctor
说我拥有 iOS 所需的一切:
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale en-ES)
[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
[!] Android Studio (version 3.5)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] IntelliJ IDEA Ultimate Edition (version 2019.3.1)
[!] VS Code (version 1.41.1)
✗ Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (1 available)
! Doctor found issues in 3 categories.
正如你所看到的,我使用了稳定渠道,以消除测试版渠道的问题,但我通常在测试版渠道中构建网页扑动 https://flutter.dev/docs/get-started/web(效果很好)。
在 iOS 模拟器中,该应用程序也运行良好。
最近我发现我没有这个文件ios/Podfile
。我发现这个帖子 https://stackoverflow.com/questions/51599686/flutter-podfile-and-pods-folders-not-created-in-ios-directory谈论那个。我不知道这对我来说是否重要,但我尝试手动添加Podfile https://github.com/flutter/flutter/blob/master/examples/flutter_view/ios/Podfile。无论如何,我得到了相同的签名错误。
对此感到沮丧,我转向原生脚本 https://www.nativescript.org/目前。