Questions tagged [alamofire]

Alamofire is an HTTP networking library written in Swift.

Alamofire is an HTTP networking library written in Swift.

Features

  • Chainable Request / Response Methods
  • URL / JSON / plist Parameter Encoding
  • Upload File / Data / Stream / MultipartFormData
  • Download File using Request or Resume Data
  • Authentication with URLCredential
  • HTTP Response Validation
  • Upload and Download Progress Closures with Progress
  • cURL Command Output
  • Dynamically Adapt and Retry Requests
  • TLS Certificate and Public Key Pinning
  • Network Reachability
  • Comprehensive Unit and Integration Test Coverage

Project

6065 questions
14
votes
3 answers

Using FORM DATA with Alamofire

I am using alamofire for some time now, but I have never used a form data Post. Now I am stuck. I have 2 params (email, password) and don't know how POST them to server. Can anyone give me an example please?
Pan Mluvčí
  • 1,242
  • 2
  • 21
  • 42
14
votes
2 answers

how to serialize json response to dictionary in alamofire 2 with swift 2 without swifty json

This code used to work in the previousversion of alamofire before swift 2. Now it gives a warning: cast from Result to Dictionary always fails. Alamofire.Manager.sharedInstance.request(.POST, url, parameters:params) …
MonkeyBonkey
  • 46,433
  • 78
  • 254
  • 460
14
votes
8 answers

Cannot load underlying module for 'Alamofire'

Here is the original github issue, support sugested to open a thread here for more public support. I'm using xcode 6.4. $ pod --version 0.38.2 My Podfile: platform :ios, '8.0' use_frameworks! target 'Turnt' do pod 'Starscream' pod…
Struki84
  • 175
  • 1
  • 1
  • 12
14
votes
5 answers

Alamofire Accept and Content-Type JSON

I'm trying to make a GET request with Alamofire in Swift. I need to set the following headers: Content-Type: application/json Accept: application/json I could hack around it and do it directly specifying the headers for the request, but I want to…
jlhonora
  • 10,179
  • 10
  • 46
  • 70
14
votes
2 answers

Swift and using class extension

I don't understand why programmers use the extension keyword in their class implementation. You can read in other topics that code is then more semantically separated and etc. But when I work with my own code, it feels clearer to me to use // MARK -…
Deny
  • 1,441
  • 1
  • 13
  • 26
14
votes
8 answers

Alamofire framework not found

I am trying to install alamofire into my project so I can upload images to my server, however I cannot seem to find the alamofire.framework file. I have downloaded the git twice, done the installation instructions on…
user3723418
13
votes
2 answers

how to upload image (Multipart) using Alamofire 5.0.0-beta.3 (Swift 5)

I am working on uploading image using multipart. This Code Working fine in swift 4 and Alamofire 4. Please give any solution for this. public class func callsendImageAPI(param:[String:…
korat krunal
  • 133
  • 1
  • 1
  • 6
13
votes
5 answers

How to implement Codable while using Realm

Hy I am working on app that uses Realm and Alamofire. I am really happy in using these library in my iOS project. But then I have to post a List of models that contains multiple lists of models. So that is too much deep thing I mean List inside…
A.s.ALI
  • 1,992
  • 3
  • 22
  • 54
13
votes
2 answers

Swift wait for closure thread to finish

I'm using a very simple swift project created with SPM where it includes Alamofire. main.swift: import Alamofire Alamofire.request("https://google.com").responseString(queue: queue) { response in …
Leonardo Marques
  • 3,721
  • 7
  • 36
  • 50
13
votes
4 answers

Trying to pass Generic type as parameter in Swift

I am Using AlamofireObjectMapper i need to make a func that take a Generic parameter like that : func doSomething < T : BaseMappable > (myCustomClass : T) { Alamofire.request("url", method: .get, parameters: nil, encoding:…
Muhammed
  • 584
  • 1
  • 11
  • 24
13
votes
3 answers

Live search throttle in Swift 3

I'm trying to live search at my PHP API with Swift. Until now i've done this thing. var filteredData = [Products]() func getSearch(completed: @escaping DownloadComplete, searchString: String) { let parameters: Parameters = [ …
Konstantinos Natsios
  • 2,874
  • 9
  • 39
  • 74
13
votes
2 answers

eTag support using Alamofire 4

I am trying to enable eTag support in my app. I am using Alamofire 4 in my swift 3 project. It seems that eTag is transparently handled by URLRequest which Alamofire uses: NSURLCache and ETags But it doesn't work. Here is http header sent by web…
thierryb
  • 3,660
  • 4
  • 42
  • 58
13
votes
2 answers

Getting client certificate to work for mutual authentication using Swift 3 and Alamofire 4

I am trying to figure out how to use Alamofire 4.0 with Swift 3.0 to send a p12 (i also have the PEM cert and key if need be) to a website for authentication. All the examples i have seen are for Swift 2.0 and not exactly what i'm looking for. …
Andrew Phillips
  • 937
  • 1
  • 7
  • 19
13
votes
5 answers

How do I download a file in Alamofire 4 and save to the Documents directory?

I'm trying to use Alamofire4 for Swift3. I need to download .mp3 files and save them to the Documents directory. Current code is like so: func downloadAudioFromURL(url: String, completion: ((_ status: ResponseStatus, _ audioLocalURL: URL?) ->…
Kex
  • 8,023
  • 9
  • 56
  • 129
13
votes
4 answers

Get image data with Alamofire request

I've updated my code to Swift 3 and am having trouble with the migration to Alamofire 4.0. I've used the Alamofire migration guide to successfully make most of the necessary modifications, but am still having trouble getting image data. The old…
Austin Wood
  • 368
  • 1
  • 4
  • 14