Questions tagged [alamofire5]
26 questions
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
6
votes
0 answers
How can I retry failed requests using alamofire?
I append failed requests to queue manager (contains array) in case of no connection
I'm presenting a custom pop-up with a retry button. When the retry button is pressed, I want to retry the requests that cannot be sent in the no connection state.…

Oguzhan Karakus
- 204
- 1
- 8
6
votes
3 answers
Convert Alamofire Completion handler to Async/Await | Swift 5.5, *
I have the current function which works. I'm using it with completion handler:
func getTokenBalances(completion: @escaping (Bool) -> Void) {
guard let url = URL(string: "someApiUrlFromLostandFound") else {
print("Invalid URL")
…

Arturo
- 3,254
- 2
- 22
- 61
5
votes
2 answers
How to decode the body of an error in Alamofire 5?
I'm trying to migrate my project from Alamofire 4.9 to 5.3 and I'm having a hard time with error handling. I would like to use Decodable as much as possible, but my API endpoints return one JSON structure when everything goes well, and a different…

Sebastien
- 3,583
- 4
- 43
- 82
3
votes
1 answer
Alamofire EmptyResponseCodes doesn't work
Endpoint responds with code 201 and an empty response body. Looking through the Alamofire documentation there is only 204 and 205 response body can be empty. There is a solution that we can specify status code with empty results.
Added set…

korgx9
- 1,234
- 22
- 30
3
votes
2 answers
Missing sessionDidReceiveChallenge in Alamofire 5 delegate
I need to migrate from Alamofire 4 to 5 but I'm missing sessionDidReceiveChallenge callback on the delegate
I used before in version 4 something like this:
let manager = Alamofire.SessionManager(
configuration:…

zombie
- 5,069
- 3
- 25
- 54
2
votes
1 answer
AlamoFire downloadProgress completion handler to async/await
I have created a download handler which uses the downloadProgress and response completion handlers, but I want to convert this to Swift 5.5's new async/await syntax since AlamoFire released a version which supports swift concurrency.
Here's my…

code24
- 458
- 1
- 3
- 14
2
votes
1 answer
How to map Alamofire 5.2 response with ObjectMapper in Swift5
I have a model like this:
import UIKit
import ObjectMapper
struct Token: Mappable {
var token: String?
var deviceId: String?
init?(map: Map) {
}
mutating func mapping(map: Map) {
token <- map["token"]
…

reza_khalafi
- 6,230
- 7
- 56
- 82
1
vote
1 answer
Adapt Alamofire requests in RetryPolice
i used RetryPolicy in my code with this class:
open class ConnectionLostRetryPolicy: RetryPolicy {
public init(retryLimit: UInt = RetryPolicy.defaultRetryLimit,
exponentialBackoffBase: UInt =…

Sajjad
- 1,536
- 2
- 17
- 31
1
vote
2 answers
Swift form-data using Alamofire 5 with parameters
I am beginner iOS developer and I don't know how to upload a file using Alamofire 5, I know there are a lot of similar questions, but all the topics here are from very old versions and I couldn't get it working. I tried this code, but I couldn't fit…

MoonlightRitual
- 11
- 3
1
vote
1 answer
Alamofire how to maintain request order?
i am using a single serial queue as the rootQueue / request / serialization queue
let queue = DispatchQueue(label: "APIManager.rootQueue")
a.session = Session(configuration: sessionConfiguration,
delegate: a,
…

Peter Lapisu
- 19,915
- 16
- 123
- 179
1
vote
1 answer
Access Localhost API using Alamofire
my url https://localhost:44301/api/authenticate
swift 5
Alamofire 5+
above local host is working on my swagger and on postman with ssl disabled I get proper response
private let session: Session = {
let manager = ServerTrustManager(evaluators:…

Jis Thottan
- 91
- 4
1
vote
1 answer
Alamofire upload progress
I am completely new in Alamofire (and in Swift in general). And I need to get the realtime upload progress. How to achieve that?
Here I am uploading multiple PDF documents :
AF.upload(multipartFormData: { multipartFormData in
for f in files{
…

JeanDujardin
- 162
- 1
- 10
1
vote
0 answers
Add additional headers to Alamofire Session
Session Configuration:
func createAfSession() -> Alamofire.Session {
let sessionConfig = URLSessionConfiguration.af.default
sessionConfig.headers.add(name: "abc", value: "ABC")
return Alamofire.Session(configuration:…

Roshan Sah
- 137
- 10
1
vote
0 answers
Alamofire 5: Multiple encoding types for Request
similar to this Multiple encoding types for Alamofire Request
and this
Multiple encoding types for request in Alamofire 4
I need to get some parameters into query string and
some json into htpbody
so I have something like this
public func…

Anton Tropashko
- 5,486
- 5
- 41
- 66