Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't import Alamofire

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?

like image 862
Giorgio Antonioli Avatar asked Jul 15 '15 07:07

Giorgio Antonioli


People also ask

What is alamofire and how do I use it?

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.

How do I install alamofire on a Linux project?

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

How do I install alamofire on CocoaPods?

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

Where can I find the alamofire image library?

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.


2 Answers

This issue was already reported on Github: https://github.com/Alamofire/Alamofire/issues/441

Possible fixes mentioned there:

  • Product -> Clean
  • Restart Xcode
like image 97
tilo Avatar answered Sep 20 '22 06:09

tilo


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:

enter image description here

like image 40
crubio Avatar answered Sep 21 '22 06:09

crubio