Gaby Fitcal
Gaby Fitcal

Reputation: 1954

I can't run Alamofire in Xcode 8

I have a project created in Xcode 7 some time ago. Now I have to make some changes in it. It was created in Swift 2.3 and I am used in it Alamofire. Now I have Xcode updated at Xcode 8.2.1 and the Swift Version is 3.

I meet a lot of errors now and I don't know how to make it work again.

I found same possible solutions but not works for me.

I updated my Cocoa Pods at 1.2.0. Not enough. I updated Alamofire version to last. Same result. I tried to convert to the current Swift Version. Still not good.

I found that code to put in the end of Podfile.

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '3.0'
    end
  end
end

Here is my Podfile. Maybe helps...

    # platform :ios, '9.0'

target 'LeTrans Swift' do

   pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => '3.5.0'

   pod 'KRProgressHUD'

   pod 'SwiftyJSON'

   pod 'GoogleMaps'
   pod 'GooglePlaces'
   pod 'GooglePlacePicker'

end

Upvotes: 1

Views: 184

Answers (3)

ronak patel
ronak patel

Reputation: 400

  pod 'Alamofire', '~> 4.6'

latest Alamofire pod version in swift 3.0 and Xcode 8 or later all version supported.

Upvotes: 0

Cruz
Cruz

Reputation: 2632

First of all If you updated to use xcode8 and swift3, you should use Alamofire 4.x version not use Alamofire 3.x (which is for swift 2.x)

3.5.0 version used in Swift2.2 or Swift2.3 so you should upgrade version to 4.x

Try

pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => '3.5.0'

change to

pod 'Alamofire', '~> 4.3'

Upvotes: 2

emraz
emraz

Reputation: 1613

Completely remove pod file from your project and reinstall it.Follow the steps for reinstalling. I have attached here a sample pod file. I have tested it in Xcode 8.2.1. Hope it will help you.

  1. cd path to project file
  2. pod init
  3. open -a Xcode Podfile
  4. put your pod file name like below
  5. pod install

Please follow the sample pod file given below.

# Uncomment this line to define a global platform for your project

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target 'Ebook' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks

  # Pods for Ebook
    pod 'Alamofire', '~> 4.0'

  target 'EbookTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'EbookUITests' do
    inherit! :search_paths
    # Pods for testing
   end

end

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end

Upvotes: 0

Related Questions