Search code examples
alamofire

Alamofire build fails with 138 errors


I just imported Alamofire into a Swift project (via cocoapods) and my build fails because of Alamofire. XCode says there are 138 errors in Alamofire.

Here is a pick of just one error (given in the Alamofire.swift file). value of optional type String not unwrapped :

extension NSURL: URLStringConvertible {

    public var URLString: String {

        return absoluteString // error shows here

    }

}

Most errors are "swift compiler errors"

I have tried the following :

  • closing and reopening XCode
  • pod remove repo master / pod setup / pod install
  • rm -rf MyProject.xcworkspace / pod install

but no success so far.

I am running the latest cocoapods pre-release (0.39.0.beta.4) and XCode 6.4

Any suggestions ?


Solution

  • Well, you are using Xcode 6.4, which uses Swift 1.2

    Since the master branch of Alamofire now uses Swift 2.0 you'll need to update to Xcode 7

    Alternatively you can supply the version '1.3.1' in your podfile, as this was the last version using Swift 1.2.