44

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

mattt
  • 19,544
  • 7
  • 73
  • 84
Edward Potter
  • 3,760
  • 4
  • 28
  • 39

11 Answers11

42

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
carbonr
  • 6,049
  • 5
  • 46
  • 73
nalexn
  • 10,615
  • 6
  • 44
  • 48
  • 6
    The [README for the project](https://github.com/Alamofire/Alamofire) is updated now with different steps. Linking here so people have the most up-to-date version. – Matt Oct 13 '14 at 19:53
  • 2
    These directions (along with READ ME) are confusing for newbs. For example, step 2 copy the folder in finder or in xcode? 3. Where should you drop AF.xcodeproj? 4 Alamofire doesn't come up, what now? 5, 6, 7 just don't work because the the other steps failed. – botbot Dec 05 '14 at 06:55
  • 1
    So none of the answers here worked for me, I've gone over this again and again, but I still get "No such module". Project has been added under my project, deployment target is the same (8.1) for both, under my build target for the main project I've added Alamofire under Target Dependencies, Link Binary With Libraries and I've added the Copy Frameworks step, set Destination to Frameworks and added the Alamofire.framework in there. Cleared build dir, removed derived data dir, and yet when I try to do "import Alamofire" I get told there is no such module. Edit: And I've tried restarting xcode. – Christian A. Strømmen Dec 16 '14 at 09:11
  • 2
    I still cant get any of this to work. Ive followed multiple different variations of these instructions and I still get the No such module, Is it normal to see the framework names appear in RED when adding them to Link binary area. Mine always show as red text – Jason Storey Mar 29 '15 at 21:14
  • Not working after updating Xcode to 6.3. The project was working fine before – Joseph Apr 09 '15 at 13:22
  • 2
    What about instructions for CocoaPods? – user3246173 Aug 25 '15 at 15:37
  • thanks i was try it from last three days. you save my [Time=$$$] –  Aug 19 '16 at 06:45
13

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

EsbenB
  • 3,356
  • 25
  • 44
  • 2
    I just recently committed to the Alamofire project and we changed the repo to state that you should add the library to the "Target Dependencies" section and not the "Link with Binary" section. [Here is the issue](https://github.com/Alamofire/Alamofire/issues/53) with the details. – Matt Oct 13 '14 at 19:51
11

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.

barrett
  • 327
  • 1
  • 9
  • This just happened to me as well. Didn't resolve until I had same configuration in Alamofire as in my app target – Harsha Apr 26 '16 at 11:31
  • This was my issue with a different framework but similar integration! Man why can't apple have an error message like "No configuration "abcde" found". – LightningStryk Apr 25 '17 at 22:13
5

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.

irkinosor
  • 766
  • 12
  • 26
4

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!

Community
  • 1
  • 1
Thalescm
  • 155
  • 1
  • 10
2

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

Faisal
  • 752
  • 6
  • 9
1

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
Community
  • 1
  • 1
Alexander
  • 9,074
  • 2
  • 15
  • 13
1
  • Open your project's .workspace file
  • Open "Manage Schemes" of your project in Xcode
  • Select "Alamofire" in scheme list
  • Clean your project
be.with.veeresh
  • 587
  • 4
  • 6
0

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)

Ishaan Sejwal
  • 660
  • 9
  • 29
0

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

Ugur Atci
  • 167
  • 2
  • 7
-1

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

Orlando
  • 1,509
  • 2
  • 19
  • 27