1
votes

I have followed the installation instructions but am getting the following error when opening my project's xcworkspace in Xcode 9.2

The target “Alamofire” contains source code developed with Swift 2.x. Xcode 9 does not support building or migrating Swift 2.x targets. Use Xcode 8.x to migrate the code to Swift 3.

Not sure if I have an old version of Alamofire: my Podfile contains

source 'https://github.com/CocoaPods/Specs.git' platform :ios, '9.0' use_frameworks! target 'raceQs' do pod 'Alamofire', '~> 4.5' pod 'DLAlertView' pod 'CocoaAsyncSocket' pod 'GoogleAnalytics-iOS-SDK' pod 'SWRevealViewController' pod 'SSKeychain' pod 'SSZipArchive' pod 'mailcore2-ios' pod 'CrashlyticsFramework' end

pod install reported

Installing Alamofire (4.6.0)

3

3 Answers

3
votes

Don't pass the Alamofire version. Make the following changes to your podfile.

source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!

target 'raceQs' do
  pod 'Alamofire'
  //rest of your pods
end
0
votes

Fixed by doing as the advice instructed. I downloaded Xcode 8.3.3 from the developer site loaded my project (which of course generated '000s of errors) and followed the prompts to upgrade to Swift 3. Then closed 8.3.3, and opened my project in Xcode 9.2 - sweet! Just 1/2 hour of my life I won't get back.

OOPS.. I spoke too early.... Althugh the project now opens in Xcode 9, when I add import Alamofire into my Swift module in my watchkit Extension I get "No such module Alamofire"

0
votes

I never succeeded by using Pods. However, I have got it working using the "other" method. First, I downloaded Alamofire and copied to my Project folder: My app is raceqs and I have copied the Alamofire projects to the raceqs project folder:

Then, I imported Alamofire.xcode into my project in Xcode: enter image description here

Then I updated my Embedded Binaries and Linked Frameworks with Alamofire.framework: enter image description here

There is some weird issue with Xcode, that causes it to take a while - 5 minutes or so, before it recognises import Alamofire in my Swift code file.