I am running XCode 7, Swift 2.0, iOS 9.
I want to install Alamofire in my project using Cocoapods. I have done the following:
gem install cocoapods
pod setup
pod init
Updated Podfile to:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
use_frameworks!
target 'JSONeg' do
pod 'Alamofire', :branch => 'swift-2'
end
Then I installed the pod:
pod install
And I added the following to ViewController.swift
import Alamofire
This raises the following error:
Cannot load underlying module for 'Alamofire'
I tested with another pod and it raised the same error, so I guess the problem is with the installation of Cocoapods. Any help would be greatly appreciated.
try Build For testing works for me
Cannot load underlying module for 'x'for SWIFT :
How to fix the Issue:
step:1 Create a New project and build&run Successfully without installing pod.
step:2 After build&run the Project Successfully ,Now try to install pod and then try to importrealm,alamofire,charts etc it will work like a charm.
Failure Case --> New project -> Add (realm,alamofire,charts etc) via cocoapods w/o building first -> open Xcode workspace -> build&run
Success Case -->New project -> build&run -> add (realm,alamofire,charts etc)via cocoapods -> open Xcode workspace -> build&run again = success
Setting
GCC_SYMBOLS_PRIVATE_EXTERN
(displayed as "Symbols Hidden by Default" in target settings) toYES
in framework being linked helped me to get rid of this error. I've spent 2 days to find this out, hope it will help someone :)Have you checked if you have a recent version of Cocoapods ? You can update by either updating all your gems :
or just reinstall Cocoapods:
If that doesn't help take also a look at : CocoaPods - build for iOS 9 / Swift 2 with Xcode-beta
where is shows you how to easily change the Command-Line tools version in the Xcode Preferences "Locations" tab, and change "Command Line Tools" to Xcode 7.0.
This seems to be a bug in XCode. I had the same problem, and as described in the comments of another answer to this question, building the project made the error go away.
Once you have installed Alamofire pod.
Step.1 you should open your project by double click on your_project_name.xcworkspace file.
Step.2 Go to project settings --> Build Phases --> Link Binary with Libraries --> Add framework "Alamofire.framework"
Thats it!!
Now you can import the module