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
Solution 1:
Make sure you haven't added any files from Alamofire to your project except for the Alamofire.xcodeproj
Here is step by step instruction:
- Download and unarchive Alamofire
- Copy the root folder of Alamofire to any subfolder of your project. Libs, for example.
- Drag and drop Alamofire.xcodeproj to your Xcode project
- Open project settings of your project, Build Phases pane, expand Target Dependencies section, and add Alamofire as new dependency
- Open General pane, expand Embedded Binaries section, and add Alamofire.framework
-
import Alamofire
// in your source file -
Alamofire.request(.GET, "http://httpbin.org/get")
// use Alamofire
Solution 2:
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
Solution 3:
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.
Solution 4:
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.
Solution 5:
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!