Using Xcode 7
I am trying to install Alamofire in a sample project. Have used the instructions from Ray Wenderlich\'s page
Only change from above link is the
Try this one.
For Swift 2.0 there is no need to add Alamofire.xcodeproj into your xcode. Simply copy and paste source folder from https://github.com/Alamofire and you are done.
or if you want to install Alamofire from Cocoapods then try below code.
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Alamofire', '~> 2.0'
I am using swift 3, I fixed this problem by deleting Derived Data
for this project.
Cheers...!!!
For reference to anyone who comes across this problem in the future:
Swift 2.x + CocoaPods 1.x
Symptoms: build works in Xcode for debug configuration but fails when xcodebuild
is executed from console using pod lib lint
or similar command. The result is error: no such module 'X'
Solution:
In MyProject.podspec
add your dependencies without specifying versions:
spec.dependency "Alamofire"
The Podfile
should also contain the same dependencies. Then run:
$ pod install && open MyProject.xcworkspace
You should open .xcworkspace
instead of .xcodeproj
. The build will now work in both Xcode and console and pod lib lint
passes validation.
I wrote this because I was trying to publish a new CocoaPods pod library and had a similar issue but found no answer and also because Google leads to this question.
After doing @satoshin answer, I also had to check the Shared
box on the right hand side of the Manage Schemes
window.
If clean project/restart xcode/reinstall cocoapods etc, did not work. You can try running Product
-> Build for
-> Testing (cmd + shift + u)
. The build failed but the import worked right after.
import Alamofire after importing UIKit Then comment it out, build the project first. Uncomment it. (this worked for me, and others, when the other answers did not).