xcode Flutter 在我的 Flutter 应用程序的根目录上构建 IOS 不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/52470137/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Flutter build IOS on root of my flutter app does not work
提问by heyred
Whenever I run this command from terminal: flutter build iosin the root of the project for my flutter app, I get back:
每当我从终端运行此命令时:flutter build iosin the root of the project for my flutter app, 我回来了:
Cannot find "xcodebuild". Xcode 9.0 or greater is required to develop for iOS.
找不到“xcodebuild”。为 iOS 开发需要 Xcode 9.0 或更高版本。
Encountered error while building for device. I have the lastest Xcode (Version 10.0).
为设备构建时遇到错误。我有最新的 Xcode(10.0 版)。
Flutter doctor:
颤振医生:
[?] 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.
I assume the IOS issue is thrown as I am running Xcode from an external HD
我认为 IOS 问题是在我从外部 HD 运行 Xcode 时引发的
采纳答案by heyred
Issue fixed, by switching to dev channel, and moving Xcode from external HD to internal, command executed successfully.
问题已解决,通过切换到开发频道,并将 Xcode 从外部 HD 移动到内部,命令成功执行。
回答by Günter Z?chbauer
The suggestion from flutter doctor -v
is quite clear
来自的建议flutter doctor -v
很明确
? 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/Develope
You could try starting Xcode and agree when it asks to install missing components.
您可以尝试启动 Xcode 并在它要求安装缺少的组件时同意。
Id suggest you try the dev
or master
channel where support for Xcode 10 should have landed. Otherwise check this suggestion https://github.com/flutter/flutter/issues/20685#issuecomment-413524718
我建议您尝试应该支持 Xcode 10的dev
或master
频道。否则检查这个建议https://github.com/flutter/flutter/issues/20685#issuecomment-413524718
回答by ifteeVai
If you Installed Xcode 10 manually via Apple Developer Download Center or Other Sources, then At first, RENAME your Xcode to the Version name you downloaded, like I downloaded the Xcode 10.1 version, so for me the renamed name would be Xcode10.1.app the .app extension is optional as it already has .app extension...
如果您通过 Apple 开发人员下载中心或其他来源手动安装了 Xcode 10,那么首先,将您的 Xcode 重命名为您下载的版本名称,就像我下载 Xcode 10.1 版本一样,所以对我来说重命名的名称将是 Xcode10.1.app .app 扩展名是可选的,因为它已经有 .app 扩展名...
After that, paste this Command on your Terminal,
之后,将此命令粘贴到您的终端上,
sudo xcode-select --switch /Applications/Xcode10.1.app/Contents/Developer
Note: the Xcode Version (i.e. Xcode10.1.app ) is Mendatory, if it's there good otherwise, Rename and add it, it's COMPLETELY SAFE and doesn't have any side effects
注意:Xcode 版本(即 Xcode10.1.app )是 Mendatory,如果它在其他方面很好,请重命名并添加它,它是完全安全的,没有任何副作用
回答by samuel samer
- Install Xcode (get it from https://developer.apple.com/xcode/) if you don't have it yet.
- Accept the Terms and Conditions.
- Ensure Xcode app is in the /Applications directory (NOT /Users/{user}/Applications).
- Point xcode-select to the Xcode app Developer directory using the following command:
- sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
- 如果您还没有安装 Xcode(从https://developer.apple.com/xcode/获取)。
- 接受条款和条件。
- 确保 Xcode 应用程序位于 /Applications 目录中(不是 /Users/{user}/Applications)。
- 使用以下命令将 xcode-select 指向 Xcode app Developer 目录:
- 须藤 xcode-select -s /Applications/Xcode.app/Contents/Developer