Xcode cannot find Alamofire, error: no such module 'Alamofire'

I am trying to include Alamofire in my Swift project after the github instruction ( https://github.com/Alamofire/Alamofire#cocoapods ).

I created a new project, went to the project directory and sudo gem install cocoapods this command sudo gem install cocoapods . Then I came across the following error:

 ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/pod 

After searching, I managed to install cocoapods by running this command sudo gem install -n /usr/local/bin cocoapods

Now I create a pod file using pod init and edited it as follows:

 # Uncomment this line to define a global platform for your project # platform :ios, '9.0' target 'ProjectName' do # Comment this line if you're not using Swift and don't want to use dynamic frameworks use_frameworks! # Pods for Law pod 'Alamofire' target 'ProjectNameTests' do inherit! :search_paths # Pods for testing end target 'ProjectNameUITests' do inherit! :search_paths # Pods for testing end end 

Finally, I run pod install to install Alamofire. After that I open the project and the import Alamofire gives me the following error No such module 'Alamofire'

Update-1: Results of pod install :

 Analyzing dependencies Downloading dependencies Using Alamofire (3.4.0) Generating Pods project Integrating client project Sending stats Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed. 
+7
ios xcode swift cocoapods alamofire
source share
8 answers

Open .xcworkspace, not .xcodeproj

+6
source share

I suggest you change your pod file as below:

 # Uncomment this line to define a global platform for your project platform :ios, '8.0' # Uncomment this line if you're using Swift use_frameworks! pod 'Alamofire', '~> 3.0' <<<---- Alamofire library is cross beetween projects target 'NotifyM' do end target 'NotifyMTests' do end target 'NotifyMUITests' do end 

Another thing: use_frameworks! you should use this if your project is based on Objective-C and try using the p Swift library.

UPDATE : for the new version of cocoapods version 1.x, the shared library should look something like this:

 # There are no targets called "Shows" in any Xcode projects abstract_target 'Shows' do pod 'ShowsKit' pod 'Fabric' # Has its own copy of ShowsKit + ShowWebAuth target 'ShowsiOS' do pod 'ShowWebAuth' end # Has its own copy of ShowsKit + ShowTVAuth target 'ShowsTV' do pod 'ShowTVAuth' end end 

as indicated on the cocoapods website: http://guides.cocoapods.org/using/the-podfile.html

+1
source share

Sometimes, for no reason, xcode cannot load the Alamofire module. This can happen after a working session after opening a project. To fix this - select the scheme → Alamofire and run. If the message is "Successful", the scheme can be changed back to the project, and it will work without problems.

+1
source share

you need to clean up the project and build before you can import this library.

+1
source share

go to Product → Scheme → Manage Schemes ... and check Alamofire true sample image this work is for me

+1
source share

You must click Target to select Alamofire and build it once before encoding.

0
source share

Install this page file

 # Uncomment this line to define a global platform for your project platform :ios, '8.0' # Uncomment this line if you're using Swift use_frameworks! target 'NotifyM' do pod 'Alamofire', '~> 3.0' end target 'NotifyMTests' do end target 'NotifyMUITests' do end 
0
source share

I suggest this work for me:

 platform :ios, '8.0' use_frameworks! target 'App' do pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git' pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git' end 

After that run: pod install in the project repository

0
source share

All Articles