Questions tagged [alamofire-request]

59 questions
12
votes
3 answers

Alamofire auto refresh token and retry previous API call in iOS Swift 4

now I'm working on an iOS application in Swift 4. Here I'm using Alamofire to integrate the API calls. I need to integrate the right way to auto-refresh the authentication token and retry the previous API calls. I'm storing the authentication token…
Hilaj S L
  • 1,936
  • 2
  • 19
  • 31
8
votes
1 answer

Generic type 'DataResponse' specialized with too few type parameters (got 1, but expected 2)

Updating to Alamofire 4.5 broke the syntax. How should I reformat my code in order for it to work? What I have: func getAllBeacons(completionHandler: @escaping ([BeaconModel]) -> ()) { let URL =…
user10307250
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
6
votes
1 answer

HTTP-GET method returns a different result in browser versus POSTMAN desktop app?

I'm building an iOS app and I need to run an HTTP request and process the response body. The problem is that my request-url is not giving the same response body when I test it out in Postman / Alamofire (swift) versus Browser /…
2
votes
0 answers

Authentication for Fantasy Premier League API - Through XCode/Alamofire

I am trying to use the Fantasy Premier League Api's, however for many of them I require a session token. According to docs, in order to achieve this I need to create a POST request and send my password/login/redirect_uri. If successful I should…
2
votes
1 answer

How to add an accepted Image MIME Type to Alamofire 5.2

I recently migrated to Alamofire 5.2 Our backend has incorrect MIME types for images that we're expected to support on the front end e.g. image.jpg instead of image.jpeg Old version of Alamofire allowed for exceptions…
Sean Dev
  • 1,239
  • 1
  • 17
  • 31
1
vote
0 answers

Generic Closure API Call with Alamofire

I've created a Network manager where I do send a request and getting the success result as below: func request(url: ServiceURL, method: HTTPMethod, parameters: Parameters?, …
artikes123
  • 153
  • 1
  • 8
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

Alamofire and downloading images from server

I need to download image as data from the URL and recreate it to UIImage(data:). The problem is, that Alamofire downloads only a small amount of image data on first request: after I make new call to my API, whole image is downloaded: It really…
Peter Hlavatík
  • 117
  • 1
  • 1
  • 11
1
vote
2 answers

Create a Json in Swift 5

I am new in swift and I want to make a post request with AlamoFire 5.4 and Swift 5 This is the object that I need to send to the server and I don't know how to create its equivalent in swift [ { "KEY": "LT_APP", …
1
vote
0 answers

NSLocalizedDescription=The certificate for this server is invalid Alamofire 5.2 Swift

I am trying to create a login screen which uses Alamofire 5.2 to post the request but I seem to get the same error over and over again, I have tried to set up the info.plist file as many have suggested bu it was of no help. I tried to change the…
user12808336
1
vote
1 answer

How can you send a nested object in the body of an Alamofire API request?

I tried to use Alamofire to make an API request like this: let param = ["id":"xy", "products":[["quantity":2, "product":["id":123]]]] Alamofire.request(url, method: .post, parameters: param, encoding: URLEncoding.default, …
Atta Ahmed
  • 71
  • 7
1
vote
1 answer

Alamofire requests while device is sleeping

My iOS app receives notification to refresh its state from our main service. Right now, we are using Alamofire to fetch the latest state and we play a continues sound when there is updated data. Our devices are locked in guided mode to stop them…
whawhat
  • 175
  • 2
  • 7
1
vote
1 answer

Alamofire Version 5.2.0 and 5.2.1 both Crash at URL Session delegate

I am using latest alamofire version 5.2.1 to make WEB API calls it working perfect with all apis But when i call api for country list it crash at URL Session Delegate class open func urlSession(_ session: URLSession, dataTask: URLSessionDataTask,…
Jaydeep Vyas
  • 4,411
  • 1
  • 18
  • 44
1
2 3 4