在 iOS 设备上尝试时 Flutter 签名无效

Fer*_*nch 11 ios flutter

TL; 博士

编辑 2020-05-06:我的应用程序从 iOS 13.4 正确安装,但一段时间后应用程序在启动时崩溃,我必须重新安装它。我不知道为什么。也许在iOS更新之后?

另请参阅以下答案:https : //stackoverflow.com/a/60013390/1121497

完整问题

我正在尝试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'
Run Code Online (Sandbox Code Playgroud)

如果我尝试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.)       ?
Run Code Online (Sandbox Code Playgroud)

在 Xcode 中,我配置了一个团队(个人团队)并且签名证书(Apple 开发证书)看起来不错,因为我可以在我的设备上安装一个 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.
Run Code Online (Sandbox Code Playgroud)

如您所见,我使用了稳定通道来解决 beta 通道的问题,但我通常在 beta 通道中工作以构建用于 web 的 flutter(工作正常)。

在 iOS 模拟器中,该应用程序也运行良好。

最近我注意到我没有文件ios/Podfile. 我发现这篇文章在谈论那个。我不知道这对我来说是否重要,但我尝试手动添加这个Podfile。无论如何,我得到了相同的签名错误。

对此感到沮丧,我现在切换到NativeScript

Jen*_*enn 10

编辑:这已在 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。