问题
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
回答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 fileAlamofire.request(.GET, "http://httpbin.org/get")
// use Alamofire
回答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
回答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.
回答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.
回答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!
回答6:
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
回答7:
Similar errors when I used cocoapods..
I solved the problem by the following steps:
- Update to Ruby 2.2.0+. (https://stackoverflow.com/a/14182172/1453505)
- Update cocoapods 0.36.0+ (
sudo gem install cocoapods --pre
) - Again
pod install
回答8:
- Open your project's .workspace file
- Open "Manage Schemes" of your project in Xcode
- Select "Alamofire" in scheme list
- Clean your project
回答9:
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)
回答10:
I had same issue,doing that Command+B (Build project) and disappear error.
回答11:
Go to your project folder to be sure you are opening the .xcworkspace
instead of the .xcodeproj
file
来源:https://stackoverflow.com/questions/25817479/cannot-install-alamofire-in-new-xcode-project-no-such-module-alamofire