Flutter iOS physical device error: Command PhaseScriptExecution failed with a nonzero exit code

Flutter iOS physical device error: Command PhaseScriptExecution failed with a nonzero exit code

我在 Android studio 上创建了一个新的 flutter 项目。当我尝试在模拟器上 运行 它工作正常,但是当我在我的 iphone 上 运行 它给出了这个错误:

Command PhaseScriptExecution failed with a nonzero exit code

当我在 Target>Build Phases>运行 Scripts 中选中“For install builds only”复选框时,它给出了另一个错误

'Flutter/Flutter.h' file not found

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

下面是 flutter doctor 的输出

[✓] 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!

首先,您需要取消选中“仅用于安装版本”。然后你需要做的就是确保你的 MacBook 和你的 iPhone 在同一个 apple id 上。

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

现在在您的实体设备 (iPhone) 上尝试 运行