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
48
votes
11 answers

Handle timeout with Alamofire

Is it possible to add timeout handler for Alamofire request? In my project I use Alamofire this way: init() { let configuration = NSURLSessionConfiguration.defaultSessionConfiguration() configuration.timeoutIntervalForRequest = 30 …
IgorNikolaev
  • 1,053
  • 1
  • 12
  • 28
46
votes
2 answers

SSL_ERROR_SSL(1): operation failed within the library

I am getting some SSL Errors (which are causing my project to stop/hang with no crash as I have a DispatchGroup waiting for the request), which I don't know how they are caused, what they are, or what to do about it. I have read numerous pages…
George
  • 25,988
  • 10
  • 79
  • 133
46
votes
12 answers

upload image to server using Alamofire

this is my code that I want to upload image to server using Alamofire, it not error but it can't push image to server. what should I do? let url = URL(string: urlString)! var urlRequest = URLRequest(url: url) urlRequest.httpMethod = "POST" let…
Chea Sambath
  • 1,305
  • 2
  • 13
  • 16
46
votes
4 answers

Swift 3 Alamofire multipart upload

Thanks to migration to Swift 3, I find it difficult to compile my project that uses Alamofire. The problem occurs when uploading multipartFormData: Alamofire.upload(.POST, URL, headers: headers, multipartFormData: { multipartFormData…
theDC
  • 6,364
  • 10
  • 56
  • 98
45
votes
2 answers

How to add Alamofire URL parameters

I have a working scenario using Postman passing in URL parameters. Now when I try to do it via Alamofire in Swift, it does not work. How would you create this url in Alamofire? http://localhost:8080/?test=123 _url = "http://localhost:8080/" …
Chris G.
  • 23,930
  • 48
  • 177
  • 302
45
votes
3 answers

AlamoFire Download in Background Session

I am using Alamofire within a new app (A Download Manager Sample based on Alamofire) I need some clarifications about downloading files using the background session. I need to override SessionDelegate to get it works? Or just…
LastMove
  • 2,482
  • 1
  • 15
  • 25
44
votes
11 answers

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…
Edward Potter
  • 3,760
  • 4
  • 28
  • 39
41
votes
9 answers

How to check internet connection in alamofire?

I am using below code for making HTTP request in server.Now I want to know whether it is connected to internet or not. Below is my code let request = Alamofire.request(completeURL(domainName: path), method: method, parameters: parameters,…
TechChain
  • 8,404
  • 29
  • 103
  • 228
41
votes
6 answers

AlamoFire does not respect timeout interval

class APIClient { var user = User() let alamoFireManager : Alamofire.Manager? let center = NSNotificationCenter.defaultCenter() init(){ let configuration = NSURLSessionConfiguration.defaultSessionConfiguration() …
TIMEX
  • 259,804
  • 351
  • 777
  • 1,080
40
votes
3 answers

Swift variable name with ` (backtick)

I was browsing Alamofire sources and found a variable name that is backtick escaped in this source file open static let `default`: SessionManager = { let configuration = URLSessionConfiguration.default configuration.httpAdditionalHeaders =…
user3237732
  • 1,976
  • 2
  • 21
  • 28
40
votes
8 answers

How to convert a Swift object to a dictionary

I'm relatively new to iOS programming. However, I would have assumed that Swift would have an automated way of converting objects to JSON and vice versa. That being said, I have found several libraries that can do this. HOWEVER... It seems that no…
JL Gradley
  • 1,731
  • 4
  • 14
  • 15
40
votes
10 answers

How to load image in swift using Alamofire

I have a collection view controller, which load image Async by URL. (Something like Instegram) I am looking for the best way to implement the part of the loading image. please tell me what do you think First way - without any external library: …
user3728728
  • 885
  • 2
  • 11
  • 14
38
votes
7 answers

Download File Using Alamofire 4.0 (Swift 3)

In older version of Alamofire. This is how I download file let destinationPath = Alamofire.Request.suggestedDownloadDestination( directory: .documentDirectory, domain: .userDomainMask); Alamofire.download(.GET, urlString, destination:…
JayVDiyk
  • 4,277
  • 22
  • 70
  • 135
38
votes
2 answers

Does Alamofire store the cookies automatically?

I'm new to Alamofire so I'm sorry if this it's a noob question: this framework stores the cookies automatically? This is because I have a simple request like this: Alamofire.request(.POST, loginURL, parameters: ["fb_id": fbId, "fb_access_token":…
Massimo Polimeni
  • 4,826
  • 4
  • 27
  • 54
38
votes
2 answers

Alamofire : How to handle errors globally

My question is quite similar to this one, but for Alamofire : AFNetworking: Handle error globally and repeat request How to be able to catch globally an error (typically a 401) and handle it before other requests are made (and eventually failed if…
Sylver
  • 2,285
  • 3
  • 29
  • 40