46

Flutter 版本是 2.2.3,我无法在我的 iOS 模拟器上运行 de flutter 代码。

Launching lib/main.dart on iPhone 13 Pro in debug mode...
lib/main.dart:1
Xcode build done.                                           43.6s
Failed to build iOS app
Error output from Xcode build:
↳
    --- xcodebuild: WARNING: Using the first of multiple matching destinations:
    { platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
    { platform:iOS Simulator, id:320795B7-1385-4044-B442-87A9808936D9, OS:15.0, name:iPhone 13 Pro }
    { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
    { platform:iOS, id:00008101-000825EC3AE1001E, name:leobidoous iPhone, error:Device is busy (Making leobidoous iPhone ready for development, Processing cache files from device, Making the device ready for development) }
    ** BUILD FAILED **
Xcode's output:
↳
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in parallel
4

14 回答 14

11

我在更新 Xcode 时遇到了同样的问题。解决只需重新登录到 Xcode。

  1. 打开 Xcode
  2. 打开项目的 Runner.xcworkspace 文件
  3. 在以下位置登录 Xcode:“Signing & Capabilities” -> “All” -> “Signing”

第 3 项是我的问题。更新 Xcode 时,我已注销。

于 2021-09-27T12:56:15.443 回答
8

添加这些行来Podfile帮助我。

target.build_configurations.each do |build_configuration|
    build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386'
end

例子: 在此处输入图像描述

于 2021-10-12T16:16:27.073 回答
4

如果你使用 package sign_in_with_apple,它至少应该有 3.2.0 版本。

于 2021-10-18T08:37:17.500 回答
3

将此代码放入您的 Podfile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |build_configuration|
        build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386'
    end
  end
end
于 2021-12-14T07:02:55.083 回答
2

对我有用的唯一解决方案是完全删除已安装的 xcode从应用商店重新安装。

删除旧的 xcode 时,请确保删除所有残留文件 - 尤其是开发人员文件夹。 试试下面这些命令

sudo rm -rf ~/Library/Developer/
sudo rm -rf ~/Library/Caches/com.apple.dt.Xcode

并将 xcode 从Application删除到bin。这样做将彻底清除 xcode 残留,然后您可以从应用商店重新安装。

于 2021-11-15T10:30:02.220 回答
1

我遇到了同样的问题,并通过运行flutter clean为我解决了这个问题。

如果这不起作用,也请尝试重新启动 IDE。

于 2022-01-12T01:04:13.750 回答
0

我已经通过清理IDEA +flutter clean然后重新启动Mac然后从flutter项目中打开Xcode然后通过选择产品-> Celan Build文件夹清理Xcode构建然后从Xcode运行你的项目以下载依赖项来解决它

于 2021-11-25T20:12:18.157 回答
0

尝试这个。这个过程会在通过ios和android模拟器运行代码后再次重新下载ios和android开发工具。为我工作

扑干净

颤振获取

颤振通道稳定

颤振升级

并重新启动 IDE 并关闭 Xcode。对我有用,我希望这会有所帮助

于 2022-03-04T17:29:13.510 回答
0

对我来说,强制 Simulator.app 退出并再次运行命令后我很好。

于 2021-11-18T02:24:43.287 回答
0

我在颤振 2.5.3 上遇到了同样的错误。现在我降级到 2.5.1 并且该应用程序正在我的 iOS 模拟器上运行。试试这个可能对你有帮助。

于 2021-11-21T11:59:20.530 回答
0

这里的相关部分是

Command PhaseScriptExecution failed with a nonzero exit code

这意味着任何配置的脚本都Xcode > Targets > Runner > (Tab) Build Phases失败了。这里的问题是您看不到错误消息(哪个脚本失败以及原因)。

--verbose标志(短:)添加-vflutter run命令中:

flutter run -v

这会输出很多。最后,您需要向上滚动到实际的脚本错误。

一旦您知道实际错误,您可能可以轻松解决它或打开一个新的更具体的问题。

于 2021-10-09T23:49:43.847 回答
0

将以下行添加到您的 podfile。将以下行放在 Podfile 底部的 post_install do [installer] 部分中。

代码 :

target.build_configurations.each do |build_configuration|
  build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386'
end
于 2021-12-13T15:39:35.343 回答
0

我在 Flutter 2.5.1 stable 版本中遇到了同样的问题以前我使用 Zip 存档文件安装了 Flutter,现在我完全删除了该安装并使用 Git clone 进行设置 颤振文档的屏幕截图

我做了类似flutter clean、pod clear cache、pod install等 的IMP注意xcode中请检查开发者签名和运行器的功能选项等我做了这些,这些对我有用

于 2021-09-29T12:48:24.130 回答
0

根据您的情况,此处的所有答案都具有绝对消除此错误的方面。对于我自己,我可以说的是,我可以确认使用 2021 M1 macbook pro max 和一组新工具、flutter 2.8.1、dart 1.15.1 并在我的 podfile 中包含以下或类似的 post_install 部分也使违规输出。

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf'
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
      config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
      config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386'
    end
  end
end
于 2022-01-13T18:22:01.173 回答