通过Carthage更新到Alamofire 4.0和Swift 3.0

时间:2016-09-20 12:13:57

标签: alamofire swift3 xcode8 carthage

我正在尝试将Alamofire更新到4.0版。当我运行carthage更新时,我在构建Alamofire方案时会遇到很多错误。看起来文件没有更新为Swift 3.0语法。我做错了什么?从终端登录:

*** Checking out Alamofire at "4.0.0"
*** xcodebuild output can be found in /var/folders/ls/6t_b5mqx5s187hq2dtts6ys00000gn/T/carthage-xcodebuild.ORghi2.log
*** Building scheme "Alamofire watchOS" in Alamofire.xcworkspace
/Users/liborzapletal/Documents/Aplikace/PNG/PNG/Carthage/Checkouts/Alamofire/Source/NetworkReachabilityManager.swift:36:1: error: expressions are not allowed at the top level
/Users/liborzapletal/Documents/Aplikace/PNG/PNG/Carthage/Checkouts/Alamofire/Source/NetworkReachabilityManager.swift:36:5: error: consecutive statements on a line must be separated by ';'
/Users/liborzapletal/Documents/Aplikace/PNG/PNG/Carthage/Checkouts/Alamofire/Source/NetworkReachabilityManager.swift:74:5: error: expected declaration
/Users/liborzapletal/Documents/Aplikace/PNG/PNG/Carthage/Checkouts/Alamofire/Source/NetworkReachabilityManager.swift:74:9: error: consecutive declarations on a line must be separated by ';'
/Users/liborzapletal/Documents/Aplikace/PNG/PNG/Carthage/Checkouts/Alamofire/Source/NetworkReachabilityManager.swift:77:5: error: expected declaration
/Users/liborzapletal/Documents/Aplikace/PNG/PNG/Carthage/Checkouts/Alamofire/Source/NetworkReachabilityManager.swift:77:9: error: consecutive declarations on a line must be separated by ';'
/Users/liborzapletal/Documents/Aplikace/PNG/PNG/Carthage/Checkouts/Alamofire/Source/NetworkReachabilityManager.swift:80:5: error: expected declaration
/Users/liborzapletal/Documents/Aplikace/PNG/PNG/Carthage/Checkouts/Alamofire/Source/NetworkReachabilityManager.swift:80:9: error: consecutive declarations on a line must be separated by ';'
/Users/liborzapletal/Documents/Aplikace/PNG/PNG/Carthage/Checkouts/Alamofire/Source/NetworkReachabilityManager.swift:83:5: error: expected declaration
/Users/liborzapletal/Documents/Aplikace/PNG/PNG/Carthage/Checkouts/Alamofire/Source/NetworkReachabilityManager.swift:83:9: error: consecutive declarations on a line must be separated by ';'
/Users/liborzapletal/Documents/Aplikace/PNG/PNG/Carthage/Checkouts/Alamofire/Source/NetworkReachabilityManager.swift:89:5: error: expected declaration
/Users/liborzapletal/Documents/Aplikace/PNG/PNG/Carthage/Checkouts/Alamofire/Source/NetworkReachabilityManager.swift:89:9: error: consecutive declarations on a line must be separated by ';'
/Users/liborzapletal/Documents/Aplikace/PNG/PNG/Carthage/Checkouts/Alamofire/Source/NetworkReachabilityManager.swift:92:5: error: expected declaration
....... and many others

我使用的是迦太基版本0.18。我试过删除carthage Build和Checkout文件夹。我将Xcode 8版本设置为默认版本。现在没有任何运气。

1 个答案:

答案 0 :(得分:0)

问题在于终端默认Xcode仍然是7.我通过命令检查了它:

xcodebuild -version

返回:

Xcode 7.3
Build version 7D175

在系统中看起来默认是Xcode 8.0但不在终端中。所以我使用命令:

sudo xcode-select -switch /Applications/Xcode\ 8.app/

现在它正在发挥作用。