James Dorfman
James Dorfman

Reputation: 1818

Cocoapods: Cannot load module 'Alamofire' as 'Alamofire'

Update: I solved the question. Please see my answer below (underneath the question and comments).

This question was marked as a duplicate, but it's different because it is a brand new error that I couldn't find through any searches.


I tried installing Alamofire into my XCode project.

As per their their tutorial, I installed cocoapods onto my system. I then navigated to the folder of my existing xcode project in the terminal, and did:

pod init

I then edited the new pod file and added:

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

target 'RainyShinyCloudy' do
    pod 'Alamofire', '~> 4.4'
end

Finally, I executed the command:

pod install

My terminal told me the install was successful.

But when I opened the .xcworkspace, made a new swift class and tried to import Alamofire, I got this error:

enter image description here

One possible reason could be that I had tried to install an earlier version of alamofire earlier, deleted it and then installed this.

But I really don't know how that could have mattered.

Thanks for any help you guys can give me.

Upvotes: 0

Views: 1885

Answers (2)

Jon Shier
Jon Shier

Reputation: 12770

Actually it failed because you were trying to import AlamoFire and not Alamofire. Imports are case sensitive.

Upvotes: 3

James Dorfman
James Dorfman

Reputation: 1818

Update: I posted an answer earlier that was wrong.

But now I actually figured it out.

I made a new project, went to the settings menu by clicking on the name of my app in the project explorer.

Then I went to Linked frameworks and libraries which is at the very bottom of the General tab.

I pressed that little + icon, selected Alamofire.framework. and set the status to required

Following this, cleaning and rebuilding the project made the error go away.

Upvotes: 2

Related Questions