Always get build error : No such module 'Alamofire' - ios

I followed the instruction of Alamofire in github,
I created an xcode project named cocoapods-test & I closed it.
I go to the project folder run pod init command which generates a Podfile. Then I added the following code to the Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Alamofire', '~> 3.0'
Then, I run command pod install and this is the result in terminal:
Updating local specs repositories
CocoaPods 1.0.0.beta.6 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.
Analyzing dependencies
Downloading dependencies
Installing Alamofire (3.3.0)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `cocoapods-test.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
Then, in my project folder there is a new file called cocoapods-test.xcworkspace . I double clicked it which opens my xcode again, and I can see the Alamofire module.
Then, I opened my project's ViewController class, and import Alamofire . But no matter how many times I clean & build, I always get error No such module 'Alamofire' . Here is the screenshot:
Why I get this problem though I followed the instruction step by step?
(I am using XCode 7.2.1, Swift 2.1.1 & Alamofire 3.3.0)
======= UPDATE ========
I tried #LK Yeung 's answer, uncomment import Alamofire, then clean & build again, I got a bunch of compiler errors from Alarmofire:

You need to build the project successfully once before using the library
comment import Alamofire -> build -> uncomment import Alamofire

Make sure you have opened the "project_name".xcworkspace instead of "project_name".xcodeproj .As you are working on pods all the installed pod will be available only in your .xcworkspace project file.

I was having this exact same problem. Please make sure that you are on Xcode 7.3 and using Swift 2.2.
You can check your Swift version using xcrun swift -version. Updating Xcode to 7.3 should also automatically update Swift.
Updating Xcode resolved this issue for me.

You need to add the lib to 'the Link Binary With Libraries' section also

You can try put pod 'Alamofire', '~> 3.0' like below. And run pod install again.
target 'yourtarget' do
pod 'Alamofire', '~> 3.0'
end

If you're manually installing Alamofire (or any other framework) make sure your build configurations match between both your parent project and the sub project. For example, if your build configuration in your project is called 'Development', but Alamofire's is called 'Debug' you'll get the 'no such module' error.

Follow This Sequence
➼ Open Terminal, go to the project folder and run these commands:
sudo gem install cocoapods -n /usr/local/bin
pod install
➼ Go to this link and clear derive data folder:
~/Library/Developer/Xcode/DerivedData
➼ Then open project "xcworkspace" file and press:
Command + Shift + K
➼ and then:
Command + B
It should work now
Cheers!

try to latest updated install alamofire and also check u use alamofire latest is this in your xcode supported.
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target '<Your Target Name>' do
pod 'Alamofire', '~> 4.4'
end
try this above alamofire on your podfile

I had the same issue, the reason was that I installed the wrong version of alamofire.
I am using Xcode 7.3, swift 2.2, so alamofire 3.0 worked for me
remove the library using these steps mentioned by #Michal
Remove or uninstall library previously added : cocoapods
Then in your pod file
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, ‘9.3’ <-- your target version
use_frameworks!
target ’<your target name>’ do
pod 'Alamofire', '~> 3.0’
end

No such module 'Alamofire' Error
because you have not installed the Alamofire in your pod file
open Podfile and add this line
pod 'Alamofire'
double-check in Podfile if this line already is written then no need to write. then just update pod file
for updating your pod open your Podfile into terminal and dial
pod update

Related

Tons of issues with Alamofire when compiling xcode project

I was running my program softly and at some point (maybe closed the Xcode to reopen or updated pod file) it suddenly it can't compile anymore.
I already tried opening .xcodeproj and .xcworkspace. The first one shows this message when compiling:
The second case shows tons of issues:
This is my pod file:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'HonoluluArt' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
# Pods for HonoluluArt
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Alamofire', '~> 3.0'
pod 'GoogleMaps'
pod 'GooglePlaces'
end
Can I get any help? Thanks a lot!
try to clear pods and reinstall:
in the project folder execute: pod deintegrate
then clean pods: pod clean
Reinstall pods: pod install
this should work
also if you don't need in particular the v3 of Alamofire remove ~> 3 to install the latest version and modify your Podfile:
target 'HonoluluArt' do
use_frameworks!
pod 'Alamofire'
pod 'GoogleMaps'
pod 'GooglePlaces'
end
Alamofire ~> 3.0 is written in Swift 3. Podfile shows that this is an older codebase. You could try building you project with older version of Xcode (xCode 10.0 is last version supporting Swift 3) or you should upgrade Alamofire to actual version ~> 5.0 (you will also need to upgrade project codebase to newer Swift version).
You indicated you opened the project file and compiled. Cocoa Pod instructions clearly state after installing, you should only work in the .xcworkspace file thereafter. Can you open that and try a compile?
I just removed any reference to Alamofire. Pod file, imports, paths and stuff and it worked. I'm trying to manage the code once it is removed, but worked.
Thanks anyway!

Issues installing Alamofire pod (~4.4) in Xcode Project

I am trying to use Alamofire for my Swift project. The following is the podfile:
platform :ios, '9.0'
target 'CocoaExample' do
use_frameworks!
pod 'Alamofire', '~> 4.4'
end
I have spent around 5-6 hrs searching for solutions and tried but no luck.
Please let me know how to resolve the issue to install Alamofire ~4.4.
Follow the below steps to install Pods.
As I have just done it in sample project and it works for me :
Before we proceed make sure that you have pods installed on your computer.
With your project directory Open the terminal and hit below command
pod init
This will create Podfile in same directory.
Open Podfile and add target :
pod 'Alamofire', '~> 4.4'
fire commmand 'pod install'
This will install pod and it create pod workspace in your project.
close your xcode and go in the same directory. there will be file call yourprojectname.xcworspace . Open this file then you are all set to go.

Cocoapods frameworks not installing properly

I can't seem to understand what is going on with my project and cocoapods, Xcode cannot find the frameworks except Firebase which is why I am confused. I'm getting the error Project ' file not found. Xcode also gives me the error, In file included from <built-in>:342: I have tried to clean and build, emptying Xcode's cache and reinstalling Xcode. Can anyone please explain this thanks.
Here's my podfile:
# Uncomment this line to define a global platform for your project
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
target 'Soar_iPad' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Soar_iPad
pod 'Firebase'
pod 'Firebase/Auth'
pod 'ExpandingMenu', '~> 0.1'
pod 'SwiftyJSON'
end
I figured out what was wrong and why Xcode could not find the pod files. It was because my directory had double quotation marks in it, for example I had /username/Desktop/Project "MyApp"/Project and Xcode could not find my pod files. But for some reason I found that using single quotes worked so for example /username/Desktop/Project 'MyApp'/Project. It's weird but glad a solution was found. Thanks to everyone that helped!
Delete workspace (.xcworkspace)
Delete Podfile.lock and Pods/ directory
Make sure your project builds
Upgrade cocoapods gem install cocoapods (optional)
Close project and run pod install
Can you try this:
pod deintegrate
pod install
If it doesn't work, create a new project and add the same Podfile (just change the target name). Run pod install.
If it compiles fine, then your project must have been misconfigured somehow. You may want to migrate your project into that newly created one. (copy all files and add project references)
If it does not compile, I think there is something wrong with your system.
Please try those steps and let me know if it works.
It seems that you cocoapods is the latest version.
Try to install cocoapods that lower than 1.0.
config the podfile and run pod install.

How to get latest GoogleMaps SDK using pods

I'm trying out the google places sdk sample. I installed it using
pod try GoogleMaps
I installed GoogleMaps (1.10.5) using cocoapods
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
pod 'GoogleMaps'
checking the GoogleMaps in both steps, the one in the sample (1) contains more headers like GMSAutocompleteTableDataSource.h
Why are they different? The one in the sample seems to be a better version but the one given by pods is not the latest? Its not even in the changelog
Run pod update GoogleMaps. Cocoapods won't update the version of a pod you've already downloaded unless you explicitly run pod update or update the podspec to require a newer version. See https://guides.cocoapods.org/using/pod-install-vs-update.html for more details.
I checked the latest podspec
I just need to set the version to the latest
e.g
pod 'GoogleMaps', '~> 2.5.0'
In my project's podfile, I don't specify the version. The pod line just specifies: pod 'GoogleMaps'
So, if you don't include the version in the podfile, then the following command in a Terminal window will update to the latest version: pod 'GoogleMaps'
Please ensure the you are in the correct folder containing your podfile before entering this command.
It may take a while for Pod to process when you see this message: Updating local specs repositories.
Be patient - it took about 20 minutes.
I just ran into this error, and I updated to latest GoogleMaps per the advice above, but had to delete the app on my device and install fresh for it to resolve the error. Error was still present until I did that.

Xcode No such Module

I am trying to use the cocoapod Alamofire in Swift. However, I get the error "No Such Module" when I Import Alamofire I am using Xcode 7.2 Alamofire 3.0 and Swift 2 The following are the steps I took
1) In terminal I ran
$ sudo gem install cocoapods
There were no errors then
2) I ran
cd ~/Path/To/Folder/Containing/Project (once in the project folder I ran)
pod init
3) Then
open -a Xcode Podfile
4) Then I added
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Alamofire', '~> 3.0'
to the Podfile
5) Then I ran
pod 'Alamofire', '3.0'
followed by
pod install
I added $(SRCROOT) to runpath and buildpath.
Also I found this answer No such module "Armchair" saying to add the pre-release but I don't really understand how to do this or if this is my problem. Maybe this is obvious ,however I'm new to Swift and am not understanding.
Also should Alamofire show up in my frameworks, or pods folder? It isn't in either.
files in project
After pod init you must use the new <YourProject>.xcworkspace instead of <YourProject>.xcodeproj.
The xcworkspace contains your project and your pods after pod install.

Resources