小编典典

更改迦太基Swift版本

swift

是否可以更改用于构建框架的Carthage Swift版本?

我试图将我的项目迁移到Swift 3(在Xcode 8 beta上),并且第三方库是唯一阻止我的项目编译的东西。在为swift
3使用特定分支时,迦太基会抛出有关新Swift语法的错误。

任何帮助将不胜感激!


阅读 283

收藏
2020-07-07

共1个答案

小编典典

迦太基使用命令行工具xcodebuild来构建框架。命令行系统使用的Xcode版本由工具选择的值确定xcode-select

Usage: xcode-select [options]

Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example, 
xcodebuild) as well as the BSD development commands (such as cc and make).

Options:
  -h, --help                  print this help message and exit
  -p, --print-path            print the path of the active developer directory
  -s <path>, --switch <path>  set the path for the active developer directory
  --install                   open a dialog for installation of the command line developer tools
  -v, --version               print the xcode-select version
  -r, --reset                 reset to the default command line tools path

它需要指向Developer SDK目录,因此您可以--print-path用来检查它当前指向的位置。

xcode-select --print-path
/Applications/Xcode.app/Contents/Developer

然后更改它即可运行 sudo xcode-select --switch <path-to-beta-xcode>/Contents/Developer

2020-07-07