Flutter:无法构建 iOS 应用程序“ARCHIVE FAILED”,为设备存档时遇到错误

6 xcode ios dart flutter

我试图生成 ipa 文件以将其上传到 App Store,但不幸的是它失败了,并显示“为设备存档时遇到错误”。\n我也尝试从 Xcode 存档,但存档也失败了。它在 ios 模拟器中运行良好 (13)

\n

无法构建 iOS 应用程序\nXcode 构建的错误输出:\n\xe2\x86\xb3\n** 存档失败 **

\n

Xcode 的输出:\n在路径写入结果包:

\n
    /var/folders/8s/2st2j0d97k7cm80h3968jnx80000gn/T/flutter_tools.ph1v\n            kd/flutter_ios_build_temp_dirZbRdRw/temporary_xcresult_bundle\n    \n        error: the following command failed with exit code 0 but produced no\n        further output\n        CompileC\n        \nFailed to package /Users/sunsoft/Downloads/alifpet-app-master.\n    Command PhaseScriptExecution failed with a nonzero exit code\n    note: Using new build system\n    note: Planning\n    note: Build preparation complete\n    note: Building targets in dependency order\n    /Users/sunsoft/Downloads/alifpet-app-master/ios/Pods/Pods.xcodeproj:\n    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is\n    set to 8.0, but the range of supported deployment target versions is\n    9.0 to 15.2.99. (in target 'Sodium' from project 'Pods')\n    /Users/sunsoft/Downloads/alifpet-app-master/ios/Pods/Pods.xcodeproj:\n    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is\n    set to 8.0, but the range of supported deployment target versions is\n    9.0 to 15.2.99. (in target 'ReachabilitySwift' from project 'Pods')\n    /Users/sunsoft/Downloads/alifpet-app-master/ios/Pods/Pods.xcodeproj:\n    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is\n    set to 8.0, but the range of supported deployment target versions is\n    9.0 to 15.2.99. (in target 'Starscream' from project 'Pods')\n    /Users/sunsoft/Downloads/alifpet-app-master/ios/Pods/Pods.xcodeproj:\n    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is\n    set to 6.0, but the range of supported deployment target versions is\n    9.0 to 15.2.99. (in target 'Reachability' from project 'Pods')\n    /Users/sunsoft/Downloads/alifpet-app-master/ios/Pods/Pods.xcodeproj:\n    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is\n    set to 7.0, but the range of supported deployment target versions is\n    9.0 to 15.2.99. (in target 'AppAuth' from project 'Pods')\n    /Users/sunsoft/Downloads/alifpet-app-master/ios/Pods/Pods.xcodeproj:\n    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is\n    set to 8.0, but the range of supported deployment target versions is\n    9.0 to 15.2.99. (in target 'PusherSwiftWithEncryption' from project\n    'Pods')\n    /Users/sunsoft/Downloads/alifpet-app-master/ios/Pods/Pods.xcodeproj:\n    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is\n    set to 8.0, but the range of supported deployment target versions is\n    9.0 to 15.2.99. (in target 'GoogleSignIn' from project 'Pods')\n    /Users/sunsoft/Downloads/alifpet-app-master/ios/Pods/Pods.xcodeproj:\n    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is\n    set to 8.0, but the range of supported deployment target versions is\n    9.0 to 15.2.99. (in target 'AgoraRtcEngine_iOS' from project 'Pods')\n\n    Result bundle written to path:\n        /var/folders/8s/2st2j0d97k7cm80h3968jnx80000gn/T/flutter_tools.ph1v\n        kd/flutter_ios_build_temp_dirZbRdRw/temporary_xcresult_bundle\n    \n    Encountered error while archiving for device.\n
Run Code Online (Sandbox Code Playgroud)\n

Van*_*oor 10

这里的问题是,不幸的是,Flutter 模板默认创建的 Podfile 没有设置特定的 iOS 版本。

执行此操作可以解决此问题:

  1. ios/项目的文件夹中,打开Podfile.
  2. 在顶部Podfile,确保此行未被注释掉,并将 iOS 版本更改为 12.0。

更改自:

#platform :ios, '8.0'
Run Code Online (Sandbox Code Playgroud)

到:

platform :ios, '12.0'
Run Code Online (Sandbox Code Playgroud)
  1. pod deintegrateios/项目文件夹内的终端中运行。

  2. pod install --repo-update在你的ios/文件夹中运行

这应该可以解决问题!

如果在此之后您收到以下错误

CocoaPods 没有设置您项目的基本配置,因为您的项目已经有自定义配置集。为了让 CocoaPods 集成正常工作,请设置目标的基本配置

然后,您需要在 Xcode 中打开 iOS 工作区,并选择左上角的根项目,然后在“信息”选项卡中,选择您的配置(在本例中为“调试”)并将其更改为“无”。之后,再次执行 pod install。

在此输入图像描述