Flutter iOS 物理设备错误:Command PhaseScriptExecution failed with a nonzero exit code

Posted

技术标签:

【中文标题】Flutter iOS 物理设备错误:Command PhaseScriptExecution failed with a nonzero exit code【英文标题】:Flutter iOS physical device error: Command PhaseScriptExecution failed with a nonzero exit code 【发布时间】:2021-07-16 14:09:38 【问题描述】:

我在 android Studio 上创建了一个新的 Flutter 项目。当我尝试在模拟器上运行它时,它工作正常,但是当我在我的 iPhone 上运行它时,它给出了这个错误:

Command PhaseScriptExecution failed with a nonzero exit code

当我在 Target>Build Phases>Run Scripts 中选中“For install builds only”复选框时,会出现另一个错误

'Flutter/Flutter.h' file not found

我曾尝试删除并重新创建 ios 目录,但没有成功。

下面是颤振医生输出

[✓] Flutter (Channel stable, 2.0.5, on macOS 11.2 20D64 darwin-x64, locale en-PK)
• Flutter version 2.0.5 at /Users/naveediqbal/Development/flutter
• Framework revision adc687823a (6 days ago), 2021-04-16 09:40:20 -0700
• Engine revision b09f014e96
• Dart version 2.12.3

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/naveediqbal/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.10.1

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
  ???? https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
  ???? https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.53.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
  ???? https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available)
• Naveed’s iPhone (mobile)   • 00008030-000D14561AA3802E            • ios            • iOS 14.4
• iPhone 12 Pro Max (mobile) • 07F0FF94-7241-4A89-AA5E-A33CB40F1687 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
• Chrome (web)               • chrome                               • web-javascript • Google Chrome 90.0.4430.85

• No issues found!

【问题讨论】:

【参考方案1】:

首先,您需要取消选中“仅用于安装版本”。那么您需要做的就是确保您的 MacBook 和您的 iPhone 使用相同的 Apple ID。

附加检查: 此外,只需确保您也信任您的开发者帐户。为此,请转到您的 Iphone 设置 -> 常规 -> 设备管理并“信任”自己作为开发人员。

现在尝试在您的物理设备 (iPhone) 上运行

【讨论】:

不提 :) 我的荣幸

以上是关于Flutter iOS 物理设备错误:Command PhaseScriptExecution failed with a nonzero exit code的主要内容,如果未能解决你的问题,请参考以下文章

Flutter 物理 iOS 设备无法向我的本地 asp.net 服务器发出 api 请求

在物理设备上测试时出现 Flutter 部署错误::errSecInternalComponent

Flutter 构建 iOS 错误:在 iOS 设备中构建 Flutter 应用程序时遇到错误

Flutter 应用程序在 Android 模拟器上运行,但不在物理设备上(OnePlus 7T)

Flutter 无法在物理设备上加载图像资产(但在模拟器上加载它就好了)

Flutter 应用程序停留在物理 iPhone 的安装和启动步骤