ios - 尝试在 iOS 项目中安装 FontAwesomeSwift 时 Carthage 失败

标签 ios objective-c swift xcode7

我正在尝试在我的 Xcode 项目 (Swift) 中安装 FontAwesome.Swift,所以我使用以下行创建了一个 Cartfile

github "thii/FontAwesome.swift" >= 0.4.1

如这里所述。然后我跑了

迦太基更新,这发生了:

==> carthage update
*** Fetching FontAwesome.swift
*** Checking out FontAwesome.swift at "0.6.0"
*** xcodebuild output can be found in /var/folders/fr/sn4l2f393_v_ytcwkb0lx7_40000gp/T/carthage-xcodebuild.4QnCto.log
*** Building scheme "FontAwesome" in FontAwesome.xcodeproj
** BUILD FAILED **


The following build commands failed:
    CompileSwift normal x86_64 <path_to_project>/<ProjectName>/Carthage/Checkouts/FontAwesome.swift/FontAwesome/FontAwesome.swift
    CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(2 failures)
<path_to_project>/<ProjectName>/Carthage/Checkouts/FontAwesome.swift/FontAwesome/FontAwesome.swift:72:61: error: 'String.Index' does not have a member named 'advancedBy'
A shell task failed with exit code 65:
** BUILD FAILED **


The following build commands failed:
    CompileSwift normal x86_64 <path_to_project>/<ProjectName>/Carthage/Checkouts/FontAwesome.swift/FontAwesome/FontAwesome.swift
    CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(2 failures)

最佳答案

我从错误信息中推断出:

'String.Index' does not have a member named 'advancedBy'

您还在使用 Xcode 6.x 吗? advancedBy API 仅适用于 Xcode 7 附带的 Swift 2.0。

所以,你有两个选择:

  1. 将您的项目升级到 Xcode 7/Swift 2.0
  2. 编辑项目的 Cartfile,使其获取与 Xcode 版本兼容的 FontAwesome.swift 版本。 FontAwesome.swift 似乎已迁移到版本 0.6 的 Swift 2.0,因此指定版本 < 0.6(而不是 >= 0.4.1)可能会成功。

如果您安装了两个版本的 Xcode,那么 Carthage 可能仍会使用 Xcode 6.x 中的命令行工具,而不是更新的命令行工具。您可以在终端中使用 xcodeselect 命令修复此问题,但也可以在 Xcode 首选项(位置选项卡)中切换到所需的工具版本。

关于ios - 尝试在 iOS 项目中安装 FontAwesomeSwift 时 Carthage 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32836876/

相关文章:

objective-c - NSInvalidArgumentException 问题

Objective-C 初始化(静态方法)调用了不止一次?

iphone - Objective-c UIImage 存储在 MSMutableArray 替代方案中,潜在的内存泄漏?

swift - 如何将元组加在一起

ios - 如何将图标放入 UITextField 中?

ios - 静默配对 iBeacon

swift - 如何在 UITableViewDiffableDataSource 中添加标题名称

swift - Xcode 6x 和 7x 之间的 configureCell 不同

ios - 如何避免 XCode 每次运行时都重置我的 iPhone 上的位置

iphone - 在 iOS 上使用与核心数据的关系