Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot install Alamofire in new Xcode Project. "No Such module Alamofire"

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

enter image description here

enter image description here

like image 476
Edward Potter Avatar asked Sep 12 '14 21:09

Edward Potter


People also ask

How do I use Alamofire in SwiftUI?

Adding Alamofire Into Our ProjectLaunch a new Xcode, SwiftUI based project and add the Alamofire dependency. You can use Cocoapods, Swift Package Manager or Carthage, whichever works the best for you. Once that's done, simply import Alamofire into your Swift class.


2 Answers

Make sure you haven't added any files from Alamofire to your project except for the Alamofire.xcodeproj

Here is step by step instruction:

  1. Download and unarchive Alamofire
  2. Copy the root folder of Alamofire to any subfolder of your project. Libs, for example.
  3. Drag and drop Alamofire.xcodeproj to your Xcode project
  4. Open project settings of your project, Build Phases pane, expand Target Dependencies section, and add Alamofire as new dependency
  5. Open General pane, expand Embedded Binaries section, and add Alamofire.framework
  6. import Alamofire // in your source file
  7. Alamofire.request(.GET, "http://httpbin.org/get") // use Alamofire
like image 150
nalexn Avatar answered Sep 19 '22 10:09

nalexn


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

like image 25
EsbenB Avatar answered Sep 19 '22 10:09

EsbenB