Questions tagged [alamofire-request]

59 questions
1
vote
1 answer

Alamofire 5 swift 5 wait for the result of the alamofire query to show the initial view

The current situation is I have an initial view of login (A) and a second view when (B) has already logged in. I want that when I open the application and the user has the values stored in the UserDefaults.standard, check that the values match those…
John
  • 13
  • 3
1
vote
2 answers

Error fetch image from storage with message 'Alamofire.AFError.ResponseValidationFailureReason.unacceptableContentType'

I attemp to fetch image from Firebase storage, but have error message: Alamofire.AFError.responseValidationFailed(reason: Alamofire.AFError.ResponseValidationFailureReason.unacceptableContentType(acceptableContentTypes: ["image/x-xbitmap",…
Taras
  • 1,485
  • 1
  • 16
  • 31
1
vote
1 answer

How to print HTTPBody using alamofire multipart request Swift

How to print HTTPBody using alamofire multipart request Swift Right now I am trying with below code but app crash on this line print("HTTP Body \(String(data: (response.request?.httpBody)!, encoding: .utf8) ?? "HTTP body not found")") I am using…
Vivek
  • 4,916
  • 35
  • 40
1
vote
2 answers

Not able to upload camera images using Almofire multipart

I have to upload images, audio, documents. I'm using Alamofire to upload. Everything is uploaded including gallery images like screenshots, but pictures taken from camera are not getting uploaded. Here's my code: func…
Krutika Sonawala
  • 1,065
  • 1
  • 12
  • 30
1
vote
1 answer

Alamofire error to decode JSON response with Struct

I have a problem with my alamofire.request. The response is nil but I don't understand why. My problem are: I use API of OpenFoodFacts, it works with a web address of this style: https://fr.openfoodfacts.org/api/v0/produit/3366321054229 I use…
0
votes
0 answers

retry alamofire request when I get statusCode 401

i have request builder with alamofire, and sometimes I have 401 statusCode (about token what need to refresh). how do I need to change the class network in order to be able to refresh the token and resend the request? when I receive statusCode 401…
0
votes
1 answer

How to pass mixed argument type to Alamofire request

I am trying to send a request with mixed type parameter in Alamofire like below: let params = [ "page": 1, "userdIds": [1,2,3], "domain": "github.com" ] as [String : Any] // Error: Type 'Any' cannot conform to 'Encodable' return try!…
Farid
  • 2,317
  • 1
  • 20
  • 34
0
votes
0 answers

Authorization of api request is no longer working

I have implement my api with header like image1 with the following code for Alamofire request. And it was working fine. var headers: HTTPHeaders = [.authorization(bearerToken: token] But later my web developer changed some thing in his api…
Jamil
  • 2,977
  • 1
  • 13
  • 23
0
votes
1 answer

Alamofire upload JSON response not compiling

I'm doing an Alamofire upload to the server and want to decode some JSON that's sent back in response. AF.upload(multipartFormData: { multiPart in //do upload stuff to the server here }, to: server) .uploadProgress(queue: .main,…
nickcoding2
  • 142
  • 1
  • 8
  • 34
0
votes
1 answer

how to use alamofire httpstatusCode

I want a diffrerent responseDecodable on the httpStatusCode server return if statusCode == 200 resonseBody {id: number} if statusCode 400..<500 resonseBody { code: String timestamp: String message: String } so now my code is AF.request(url,…
junbok
  • 11
  • 2
0
votes
1 answer

Why is ssl pinning not working on synchronous requests?

I want to do ssl pinning with Alamofire library, but it doesn't work for sync requests. I am using the following library to sync Alamofire request: https://github.com/Dalodd/Alamofire-Synchronous In async call I get cancaled with code -999 but when…
OMANSAK
  • 1,066
  • 1
  • 12
  • 30
0
votes
0 answers

Alamofire reports downloadProgress incorrectly when downloading multiple URLs in same request

func test(){ let urls = ["https://www.sample-videos.com/zip/30mb.zip", "https://www.sample-videos.com/zip/30mb.zip", "https://www.sample-videos.com/zip/30mb.zip"].compactMap { URL(string: $0) } for i in urls{ …
achinthaishane
  • 77
  • 1
  • 2
  • 9
0
votes
1 answer

Alamofire responseDecodable for model for response and error

I'm using Alamofire to make API calls from mobile app. I have struct which is map from Alamofire API calls this way APIManager.shared.session.request(UserRouter.signUp(username, password)).responseDecodable (of: User.self) { response in …
mike
  • 1
  • 1
  • 1
0
votes
0 answers

Alamofire synchronous request

I'm trying to make a Log In Call to the backend using Alamofire 5. The problem is when I make the call I need a value to return to the Controller to validate the credentials. So, the problem is Alamofire only make asynchronous calls so I need to…
0
votes
0 answers

Alamofire stacking responses

I am using Alamofire to communicating with my API, also I am using RequestInterceptor to catch unauthorized requests or for refreshing the JWT token. When everything is going well, there is no problem at all, but in case of bad response (400,401)…
Peter Hlavatík
  • 117
  • 1
  • 1
  • 11