ios - Flutter 在我的 Flutter 应用程序的根目录上构建 IOS 不起作用

每当我从终端运行此命令时:flutter build ios 在我的 Flutter 应用程序的项目根目录中,我都会返回:

Cannot find "xcodebuild". Xcode 9.0 or greater is required to develop for iOS.

为设备构建时遇到错误。 我有最新的 Xcode(10.0 版)。

flutter 医生:

[✓] Flutter (Channel beta, v0.8.2, on Mac OS X 10.13.6 17G65, locale en-GB)
    • Flutter version 0.8.2 at /Users/h/flutter
    • Framework revision 5ab9e70727 (2 weeks ago), 2018-09-07 12:33:05 -0700
    • Engine revision 58a1894a1c
    • Dart version 2.1.0-dev.3.1.flutter-760a9690c2

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at /Users/h/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-27, build-tools 27.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_152-release-1024-b01)
    • All Android licenses accepted.

[!] iOS toolchain - develop for iOS devices
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
      Download at: https://developer.apple.com/xcode/download/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
    • ios-deploy 1.9.2
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 24.2.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] Connected devices (1 available)
    • h iPhone • 77afb908fc6c490d3fca62cdde9a74ab4e45b4f0 • ios • iOS 11.4.1

! Doctor found issues in 1 category.

我假设在我从外部 HD 运行 Xcode 时引发了 IOS 问题

最佳答案

我的问题的根源是 Flutter 找不到最新安装的 Xcode 版本。

要修复它,请转到 Xcode->preferences->locations->set value for command Line tools。

https://stackoverflow.com/questions/52470137/

相关文章:

dart - Flutter 小部件测试 : StreamBuilder snapshot has

dart - 具有水平列表和网格的 Flutter 可滚动主体作为子项

dart - 如何在没有 Scaffold.drawer 的情况下使用 Drawer?

android - 在 Flutter 中剪切文本效果

flutter - Flutter 中的可滚动底部工作表

dart - 在初始化程序中只能访问静态成员。 Dart2.0

dart - flutter 错误 : Could not find the correct Sco

firebase - Flutter - firebase_auth updateProfile 方

flutter - 加载数据时制作骨架屏幕的最简单方法

flutter - 内置值对象的 setter 是什么