TL;博士
编辑 2020-05-06 :我的应用程序从 iOS 13.4 正确安装,但一段时间后应用程序在启动时崩溃,我必须重新安装它。我不知道为什么。也许在iOS更新之后?
另请参阅下面的答案:https://stackoverflow.com/a/60013390/1121497
完整的问题
我正在尝试在 iOS 设备(iPhone XS)上运行一个新的 Flutter 应用程序(由 flutter create
创建的示例应用程序)。
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 项目。注:我没有支付 Apple Developer Program 的帐户 .在 iOS 设备上运行 Flutter 应用程序是绝对必要的吗?
我关注了macOS instructions和
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.
如您所见,我使用了稳定 channel ,以丢弃 beta channel 的问题,但我通常在 beta channel 中工作以构建 flutter for web (效果很好)。在 iOS 模拟器中,该应用程序也可以正常工作。
最近我注意到我没有文件
ios/Podfile
.我找到了this post谈论那个。我不知道这对我来说是否重要,但我尝试手动添加 Podfile .无论如何,我得到相同的签名错误。对此感到沮丧,我切换到 NativeScript目前。
最佳答案
编辑:这在 3 月 24 日发布的 iOS 13.4 上已修复。
这是与 Flutter 无关的 iOS 13.3.1 回归。通过创建新的 Xcode 项目、添加框架目标并选择个人团队配置文件,我能够在没有任何 Flutter 或 CocoaPods 代码的情况下重现崩溃。
请参阅 GitHub 问题:https://github.com/flutter/flutter/issues/49504#issuecomment-581554697 .
该错误不应影响已在 App Store 上签名和分发的开发人员帐户团队配置文件或应用程序。
不幸的是,唯一的解决方法可能是在解决此问题之前避免将开发设备升级到 13.3.1。
关于ios - 在 iOS 设备上尝试时 Flutter 签名无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59520593/