TL; DR
请参阅下面的答案:https : //stackoverflow.com/a/60013390/1121497
看来这是iOS 13.3的问题,因为我刚刚安装了13.4,现在Flutter可以在iPhone上使用了。:)
我正在尝试flutter create
在iOS设备(iPhone XS)上运行新的Flutter应用(由创建的示例应用)。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 Development证书)似乎还不错,因为我可以在设备上安装Hello world Swift项目。
注意:我没有支付Apple Developer Program的帐户。在iOS设备上运行Flutter应用程序是否绝对必要?
我遵循了macOS的说明,并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.
如您所见,我使用稳定通道来丢弃Beta通道的问题,但是我通常在Beta通道中工作以构建用于Web的抖动(效果很好)。
在iOS模拟器中,该应用也可以正常运行。
最近我注意到我没有文件ios/Podfile
。我发现这篇文章在谈论这一点。我不知道这对我来说是否重要,但是我尝试手动添加此Podfile。无论如何,我得到相同的签名错误。
对此感到沮丧,我现在切换到了NativeScript。
flutter build ios --release