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

Swift 2.0, Alamofire: Set cookies in HTTP Post Request

I want to set cookies in my HTTP POST request. Something like the cookie field in the HTTP Request below, version: 0.1.7 Cookie: client=Android; version=0.1.7; sellerId=SEL5483318784; key=178a0506-0639-4659-9495-67e5dffa42de Content-Type:…
dashbashrumble
  • 251
  • 1
  • 5
  • 19
11
votes
3 answers

Swift behaves differently on debug and release mode

Not sure if that's an issue with Swift, XCode or Alamofire but I recognized strange behavior on different places within my mixed Swift/Objc app. It only happens in parts which are written in Swift and use closures/networking. Here's an example code…
Jeehut
  • 20,202
  • 8
  • 59
  • 80
11
votes
1 answer

Custom NSURLProtocol to show/hide NetworkActivityIndicator

I'm working with Alamofire. Following up on Mattt's comment in one of the closed issues on GitHub, I attempted a NSURLProtocol-based mechanism to set the UIApplication.sharedApplication().networkActivityIndicatorVisible flag. However, after…
opfeffer
  • 603
  • 5
  • 19
11
votes
2 answers

Swift closure with Alamofire

I am making API calls to a server. I am leveraging Alamofire to handle this. I'm trying to create a function that uses Alamofire's GET function to return an object based on a custom class that holds the various outputs provided by this GET…
shawnzizzo
  • 373
  • 4
  • 18
10
votes
3 answers

Get upload progress for multipart upload Alamofire5

Before Alamofire5 we could user encodingReesult of uploadRequest to get uploadProgress. But now after uploading Alamofire to version 5, based on Alamofire Documentation, we can use .uploadProgress in order to get upload progress handler. Here's my…
Ali Moazenzadeh
  • 584
  • 4
  • 13
10
votes
1 answer

How to upload a file to S3 using alamofire 4.8 using multipartFormData with access key?

I am attempting to upload directly to s3 using alamofire (my app has to run on the apple watch and the aws-ios-sdk does not work on the apple watch). I know I have to sign the url but am at a loss of how to directly form the request given a url.…
Victor 'Chris' Cabral
  • 2,135
  • 1
  • 16
  • 33
10
votes
10 answers

Swift 4 AlamofireImage with UITableView Cell

I am using AlamofireImages to try to download an image from a server and display it in my table view cell, this is what I got, but my images does not appear, just the textLabel and detailTextLabel override func tableView(_ tableView: UITableView,…
user979331
  • 11,039
  • 73
  • 223
  • 418
10
votes
1 answer

What is the use of the validate() method in Alamofire.request?

Alamofire.request(.GET, getUrl("mystuff")).validate() - what is the use of the validate() method? How can I use it to validate server connection issues?
Ramesh Kumar
  • 121
  • 1
  • 1
  • 4
10
votes
2 answers

How to cancel multiple networking requests using Moya

I am currently using Moya to structure my networking calls. Per their docs, I have configured it as the following: enum SomeAPIService { case endPoint1(with: Object) case endPoint2(duration: Int) } When calling an endpoint (in this case,…
daspianist
  • 5,336
  • 8
  • 50
  • 94
10
votes
1 answer

Alamofire Uploads PNG to Flask with White Background

I am trying to implement a Flask backend endpoint where two images can be uploaded, a background and a foreground (the foreground has a transparent background), and it will paste the foreground on top of the background. I have the following Python…
genghiskhan
  • 1,095
  • 12
  • 21
10
votes
2 answers

Why does Unexpected non-void return value in void function happen?

I created a function to get URL from API, and return URL string as the result. However, Xcode gives me this error message: Unexpected non-void return value in void function Does anyone know why this happens? func getURL(name: String) -> String…
Wei Xia
  • 504
  • 2
  • 9
  • 24
10
votes
1 answer

Getting image file into body parameter

I am trying to upload file to server. I am using SlimFramework and PHP in my backend code and it is in RESTful form. Image uploading works very well if I upload it through Postman however I am not able to get it to work using Swift and Alamofire…
Tarvo Mäesepp
  • 4,477
  • 3
  • 44
  • 92
10
votes
5 answers

Alamofire.AFError.ResponseValidationFailureReason.unacceptableStatusCode(500)

I'm working on Alamofire and I am trying to post a request to the server like this: func sendRequest () { print("fire now----------------------------------------------") let parameters: Parameters = ["user": "001", "name": "josh"] …
JoshJoshJosh
  • 897
  • 2
  • 11
  • 20
10
votes
2 answers

Download many files (photos, videos) in background with priority order

At first start of app I want to download all files from server and I want to continue in downloading even when user leaves app (it's not in foreground). The files I need to download are thumbnails, photos in original size, other files and video. I…
Libor Zapletal
  • 13,752
  • 20
  • 95
  • 182
10
votes
4 answers

Alamofire 4 and special characters in JSON

I've got a problem with special characters with Alamofire 4.The JSON contains æ, ø and å and the browser shows them fine, also my previous solution using SwiftyJSON did.Alamofire 4 shows something like this instead: U00e6 Using this call:…
Recusiwe
  • 1,594
  • 4
  • 31
  • 54