Alamofire: Swift 3 Issue

Created on 4 Oct 2016  路  6Comments  路  Source: Alamofire/Alamofire

Hi Team Alamofire,

I have added Alamofire using cocoa pods - pod 'Alamofire', '~> 4.0'
I am Using Xcode 8.0 and getting a popup to convert to latest Syntax while as per the documentation here it states that it already supports Swift3.

support

Most helpful comment

@jorgecasariego Few things to try

1. gem install cocoapods --pre // just to make sure you are updated 
2. pod repo update --verbose //May take time if you are not using `pod update`
3. pod install 

All 6 comments

Please make sure few things

  1. You have Cleaned and Clear Derived data
  2. Make sure you are running CocoaPods 1.1.0+

This worked for me

pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'master'

@jorgecasariego

By default it takes master branch no need to specify this

Recommended way
pod 'Alamofire', '~> 4.0' // Support from iOS 9
OR
pod 'Alamofire', '~> 3.5' // Support rom iOS 8

@hardikdevios First, I tried adding pod 'Alamofire', '~> 4.0' but it doesn't worked, so I changed to the way I posted before

This was the output: [!] Unable to find a specification for Alamofire (~> 4.0.0)

@jorgecasariego Few things to try

1. gem install cocoapods --pre // just to make sure you are updated 
2. pod repo update --verbose //May take time if you are not using `pod update`
3. pod install 

@vishal-algoworks Make sure you transition your main project to Swift 3 before using CocoaPods 1.1.0 to install pods, as CocoaPods uses your project's Swift version setting to set the Swift version for all of your pods. Without that transition your project will trigger Xcode's update warning every time you open the project.

@jorgecasariego Like @hardikdevios said, you'll need to update your CocoaPods spec repo to pick up the latest spec versions, or just run pod update, in addition to running CocoaPods 1.1.0.

Was this page helpful?
0 / 5 - 0 ratings