Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alamofire not working (Swift/Xcode 8)

I am getting the following errors when trying to import Alamofire into my project (Cocoapods isn't working for me, so I have to manually import it).

Anyway, I'm using XCode 8 and Swift 2.3, and I'm getting these errors:

Use of unresolved identifier kSecTrustResultProceed

Contextual type AnyObject cannot be used with array literal

Update: I cleaned XCode, downloaded the latest version of Alamofire and restarted my computer. Now, XCode seems to be giving me conflicting errors (pictures for reference) Cannot force unwrap value of non-optional type String Value of optional type String? not unwrapped Thanks!

like image 738
Michael Lee Avatar asked Jul 06 '16 10:07

Michael Lee


People also ask

How do I import Alamofire into Xcode?

Open the new Alamofire folder, and drag the Alamofire. xcodeproj into the Project Navigator of your application's Xcode project. It should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter.

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.

What is Alamofire pod?

Alamofire is a Swift-based, HTTP networking library. It provides an elegant interface on top of Apple's Foundation networking stack that simplifies common networking tasks. Its features include chainable request/response methods, JSON and Codable decoding, authentication and more.

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 use alamofire with xcworkspace?

Open the file named [projectname.xcworkspace] and your project should have Alamofire installed and ready to go For this example we will be using httpbin.org to simulate our http calls. For starters let’s do a simple GET request, in your ViewController.swift type the following:

What is alamofire used for in iOS?

What is Alamofire? Alamofire is an elegant and composable way to interface to HTTP network requests. It builds on top of Apple’s URL Loading System provided by the Foundation framework. At the core of the system is URLSession and the URLSessionTask subclasses.

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


Video Answer


1 Answers

As of early September '16, you need to use the following in your Podfile:

pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => '3.5.0'

Pointing to the swift2.3 branch no longer works, as that branch has been deleted. The tag '3.5.0' points to the last revision on master that supports Swift 2.3.

like image 156
TotoroTotoro Avatar answered Sep 29 '22 21:09

TotoroTotoro