Search code examples
swiftxcodealamofire

Alamofire failing to import


I am working on a mobile app in Xcode 7.2 using swift 2.1. I installed Alamofire though cocoapods and in my podfile I specified Alamofire version 3.0 as shown below:

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

target 'SeniorSeminar' do
    pod 'Alamofire', '~>3.0'

end

After installing Alamofire, I opened up my .xcworkspace and tried importing Alamofire into one of my model files. I received the error: "No such module 'Alamofire'". I went and looked in the Podfile.lock and it shows that Alamofire version 4.0 was actually installed. I dont think version 4 is compatible with the versions of xcode and swift I am working in and I would prefer not to update either of these for fear of creating a ton of errors that I dont have time to fix. Does anyone have any suggestions on how to uninstall Alamofire -version 4 and forcing version 3 to install instead? Or are there any work arounds for why my project wont let me import Alamofire?


Solution

    • Delete you pods directory and perform a clean on your project.

    • Change your podfile pod installation line to

    pod 'Alamofire', '3.0'

    • Install your pods again
    • Perform a build! - Frameworks won't be imported until you build your project after installing them. Easy to forget.