尝试在iOS项目中安装FontAwesomeSwift时,Carthage失败了

时间:2015-09-29 06:13:04

标签: 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)

1 个答案:

答案 0 :(得分:2)

我从错误消息中推断出:

  

&#39; String.Index&#39;没有名为&#39; advancedBy&#39;

的成员

您还在使用Xcode 6.x吗? firstBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { secondBtn.setVisibility(View.INVISIBLE); new Handler().postDelayed(new Runnable() { @Override public void run() { secondBtn.setVisibility(View.VISIBLE); } }, 2000); //change it for the time you need in milliseconds } }); API仅适用于Swift 2.0,它随Xcode 7一起提供。

所以,你有两个选择:

  1. 将项目升级到Xcode 7 / Swift 2.0
  2. 编辑项目的Cartfile,以便获取与您的Xcode版本兼容的FontAwesome.swift版本。似乎FontAwesome.swift迁移到版本0.6的Swift 2.0,因此指定版本&lt; 0.6(而不是> = 0.4.1)可能会这样做。
  3. 如果你安装了两个版本的Xcode,那么Carthage仍然可以使用Xcode 6.x中的命令行工具而不是新的。您可以使用终端中的advancedBy命令解决此问题,但也可以在Xcode首选项(位置选项卡)中切换到所需的工具版本。