Edward Potter
Edward Potter

Reputation: 3820

Cannot install Alamofire in new Xcode Project. "No Such module Alamofire"

I follow the instructions to the T. Fresh install of all, yet getting the error:

"No Such module Alamofire"

Directions here:

In the meantime, you can simply add Alamofire as a git submodule, drag the Alamofire.xcodeproj file into your Xcode project, and add the framework product as a dependency for your application target.

And my screenshots

enter image description here

enter image description here

Upvotes: 44

Views: 56715

Answers (11)

Ugur Atci
Ugur Atci

Reputation: 167

I had same issue,doing that Command+B (Build project) and disappear error.

Upvotes: 0

Go to your project folder to be sure you are opening the .xcworkspace instead of the .xcodeproj file

Upvotes: -1

be.with.veeresh
be.with.veeresh

Reputation: 587

  • Open your project's .workspace file
  • Open "Manage Schemes" of your project in Xcode
  • Select "Alamofire" in scheme list
  • Clean your project

Upvotes: 1

Ishaan Sejwal
Ishaan Sejwal

Reputation: 690

What worked for me: Including "Pods.framework" in "Linked Frameworks and Libraries" of your target if it not there already. (This applies in case you are are using cocoapods and are using frameworks as modules)

Upvotes: 0

Faisal
Faisal

Reputation: 772

I resolved the error "No such module" for a fresh project, not for Alamofire but for another library called "RATreeView"

I had to add

source 'https://github.com/CocoaPods/Specs.git' 
use_frameworks!
pod "RATreeView", "~> 2.1.0"

to the Podfile and ran

pod update

The key is to add use_frameworks! It might help someone

Upvotes: 2

irkinosor
irkinosor

Reputation: 776

This order of the Build Phases has worked for me.

  • Target Dependencies
  • Link Binary With Libraries.
  • Check Pods Manifest.lock
  • Embed Pods Frameworks
  • Compile Sources

You can rearrange Build Phases by dragging them.

Upvotes: 5

Thalescm
Thalescm

Reputation: 155

After following NAlexN steps, it still didn't work for me
I also had to change the order of Build Phases.

It was
- Target Dependencies
- Compile Sources
- Link Binary With Libraries.

After I modified to:
- Target Dependencies
- Link Binary With Libraries.
- Compile Sources

It built and ran fine!

Upvotes: 4

nalexn
nalexn

Reputation: 10791

Make sure you haven't added any files from Alamofire to your project except for the Alamofire.xcodeproj

Here is step by step instruction:

  1. Download and unarchive Alamofire
  2. Copy the root folder of Alamofire to any subfolder of your project. Libs, for example.
  3. Drag and drop Alamofire.xcodeproj to your Xcode project
  4. Open project settings of your project, Build Phases pane, expand Target Dependencies section, and add Alamofire as new dependency
  5. Open General pane, expand Embedded Binaries section, and add Alamofire.framework
  6. import Alamofire // in your source file
  7. Alamofire.request(.GET, "http://httpbin.org/get") // use Alamofire

Upvotes: 42

Alexander
Alexander

Reputation: 9081

Similar errors when I used cocoapods..

I solved the problem by the following steps:

  1. Update to Ruby 2.2.0+. (https://stackoverflow.com/a/14182172/1453505)
  2. Update cocoapods 0.36.0+ (sudo gem install cocoapods --pre)
  3. Again pod install

Upvotes: 1

EsbenB
EsbenB

Reputation: 3406

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

The target Dependencies makes sure your lib is (re)-build before your target (useful when you makes changes to the lib) and the Link section makes sure the lib is available doing the link phase.

EDIT The above description works for most projects. However alarmofire just updated the process needed for this particular project here https://github.com/Alamofire/Alamofire

Upvotes: 13

barrett
barrett

Reputation: 327

Banged my head against this for a couple days and figured I would throw this in here, our team project had this issue when bringing Alamofire in as a submodule. If you have your own scheme configurations, you need to duplicate them in the Alamofire.xcodeproj too. Which also likely means you need to fork Alamofire to keep these changes synced up.

Upvotes: 11

Related Questions