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
26
votes
1 answer

How to retrieve Alamofire response header for a request

how can I retrieve response headers for a request? Below is a request I make. Alamofire.request(.GET, requestUrl, parameters:parameters, headers: headers) .responseJSON { response in switch response.result { case .Success(let…
qbo
  • 386
  • 1
  • 3
  • 8
25
votes
7 answers

Upload files with parameters from multipartformdata using alamofire 5 in ios swift

I am trying upload files with parameters (multipartformdata) but i can't do it with new version Alamofire 5, if you have some experience with Alamofire 5 please share it with me. func uploadPluckImage(imgData : Data, imageColumnName : String, …
Diaa SAlAm
  • 366
  • 1
  • 4
  • 7
25
votes
7 answers

Alamofire responseSerializationFailed(Alamofire.AFError.ResponseSerializationFailureReason.inputDataNilOrZeroLength)

I had some working code that was getting results from a MySQL DB on a remote web server. It is no longer working and I keep getting the message…
gfgruvin
  • 435
  • 1
  • 4
  • 8
25
votes
4 answers

iOS 9.3 : An SSL error has occurred and a secure connection to the server cannot be made

I am getting following error with self signed certificate Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made. while testing web-services for one of my demo app with iOS…
swiftBoy
  • 35,607
  • 26
  • 136
  • 135
25
votes
6 answers

Basic Authentication with Alamofire

Experiencing an issue when authenticating with Basic Auth. I am using a standard enum that conforms to URLRequestConvertible protocol to construct my requests. The issue is that when I manually set the authorization headers in the enum like so: …
24
votes
4 answers

Alamofire with a self-signed certificate / ServerTrustPolicy

I want to use Alamofire to communicate with my server over a https connection with a self signed certificate. My environment runs on localhost. I've tried to connect, but the response all the time looks like this: Success: false Response String:…
teawithfruit
  • 767
  • 1
  • 11
  • 22
24
votes
5 answers

Alamofire.download() method: Where is the file and did it save successfully?

The example for using Alamofire.download() works just fine, but there isn't any detail in how to access the resulting downloaded file. I can figure out where the file is and what it was named based on the destination I set and the original file…
Paul Bonneville
  • 1,905
  • 2
  • 13
  • 17
23
votes
1 answer

Alamofire 4.0 Upload MultipartFormData Header

How do we add an authentication header to the upload function of Alamofire 4.0? below is the sample code, however I see no way in adding a header to the function. Alamofire.upload( multipartFormData: { multipartFormData in …
JayVDiyk
  • 4,277
  • 22
  • 70
  • 135
23
votes
9 answers

iOS Alamofire stop all requests

Is there any way I can for example say: Alamofire.Manager.cancelAllRequests() or Alamofire.Manager.sharedInstance.cancelAllRequests()? Of course it would be great if these requests especially in case of image download would only be paused for later…
Fawkes
  • 3,831
  • 3
  • 22
  • 37
22
votes
6 answers

NSURLErrorDomain Code=-1004 for few seconds after app start up

I'm getting "NSURLErrorDomain Code=-1004" error with Alamofire API calls, but only for few seconds after app started (or took a rest for few minutes while the app's opened and make a call after that) If I try to make the same call after few seconds,…
Sebastian Kim
  • 556
  • 1
  • 6
  • 15
22
votes
7 answers

Handling XML data with Alamofire in Swift

I started to use cocoapods with my current ios project. I need to use SOAP to get content with easy way for my ios project. I have googled it and Alamofire pod is great for me. Because I am using Swift programming language. I have inited easily this…
Mehmet
  • 3,301
  • 8
  • 26
  • 36
21
votes
1 answer

Alamofire network calls not being run in background thread

It is my understanding that by default, Alamofire requests run in a background thread. When I tried running this code: let productsEndPoint: String = "http://api.test.com/Products?username=testuser" Alamofire.request(productsEndPoint,…
thetipsyhacker
  • 1,402
  • 4
  • 18
  • 39
21
votes
13 answers

Error Domain=NSPOSIXErrorDomain Code=100 "Protocol error"

I am trying to call a service using Alamofire using a .get method. The request has nothing special no parameters just an Authorization header. I am going a bit mad here because to request works fine when I run it on postman with the same URL and…
LuchoG
  • 253
  • 1
  • 2
  • 9
21
votes
3 answers

Command /bin/sh failed with exit code 1 and Embedded pods framework

Not able to identified actual issue, During updating coco pod getting a message "Re-creating CocoaPods due to major version update." (that was come only once) and pod updation is successful. After on build i am getting the error. Command /bin/sh…
Gaurav Pandey
  • 1,953
  • 3
  • 23
  • 37
21
votes
6 answers

How to upload image with parameters using Alamofire in Swift

I am developing an iPhone application with swift. and I'am using Alamofire framework for handling http requests. I use Alamofire.request for POST , GET and etc like this: Alamofire.request(.POST, myURL , parameters: ["a": "1", "b" : "2" ]) …
Reza_Rg
  • 3,345
  • 7
  • 32
  • 48