【问题标题】:Change Carthage Swift version更改 Carthage Swift 版本
【发布时间】:2016-08-23 04:18:44
【问题描述】:

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

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

任何帮助将不胜感激!

【问题讨论】:

标签: ios swift carthage swift3 xcode8


【解决方案1】:

Carthage 使用命令行工具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 &lt;path-to-beta-xcode&gt;/Contents/Developer

【讨论】:

  • 您也可以使用 Xcode > Preferences > Locations,然后使用“命令行工具”进行更改
  • 最近的 Xcode 版本支持多个 Swift 工具链。使用相同的 Xcode 版本时如何选择 Swift 版本?
  • 这里没有回答如何选择Swift版本的问题
【解决方案2】:

Carthage 的 GitHub 上有一个关于 XCode 8 和兼容性问题的错误报告。您可能想在他们的仓库中关注该问题的主题:

https://github.com/Carthage/Carthage/issues/1440

Carthage 的 repo 中报告的另一个相关问题是:https://github.com/Carthage/Carthage/issues/1445

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-01
    • 1970-01-01
    • 2016-06-15
    • 2017-01-28
    • 1970-01-01
    • 2017-05-18
    相关资源
    最近更新 更多