I'm trying to import Alamofire inside my class but I obtain the error message Cannot load underlying module for 'Alamofire'
. I did the same steps importing another library (SwiftyJSON), and it worked well. This is my podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target 'MyApp' do
pod 'SwiftyJSON', '~> 2.2.0'
pod 'Alamofire', '~> 1.2'
end
target 'MyAppTests' do
pod 'SwiftyJSON', '~> 2.2.0'
pod 'Alamofire', '~> 1.2'
end
Then I use $ pod install
and I can find Alamofire as a module under Pods.
When I put in my class import Alamofire
, it isn't found (but SwiftyJSON is).
What I'm doing wrong?
Written by the same creator as its Objective-C counterpart (AFNetworking), Alamofire is a powerful library that helps us decode JSON. In this holiday-themed 3500+ word monstrosity of a tutorial, we’re going to explore a wide range of topics essential to networking and build a holiday todo list.
Save the file and in your terminal do a pod install, once it has finished installation it should have created a Pods folder, [projectname].xcworkspace, and a Podfile.lock. Open the file named [projectname.xcworkspace] and your project should have Alamofire installed and ready to go
We’ll be using Cocoapods to install the Alamofire library. If need to set up Cocoapods on your system first, check out my Cocoapods tutorial. Now navigate to your project folder and open a terminal window, also navigate the terminal window to the project location. Once there you should do a “pod init” in your terminal
In the tab bar at the top of that window, open the "General" panel. Click on the + button under the "Embedded Binaries" section. You will see two different AlamofireImage.xcodeproj folders each with two different versions of the AlamofireImage.framework nested inside a Products folder.
This issue was already reported on Github: https://github.com/Alamofire/Alamofire/issues/441
Possible fixes mentioned there:
Anyone else having this issue could have forgot one step.
You may need to link Alamofire (or SwiftyJSON) to your project.
Project > Target > General > Linked Frameworks and Libraries:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With