Questions tagged [alamofire-request]

59 questions
0
votes
0 answers

How do I save the JSON data into my localhost? http post response says "200"

let parameters = ["lat": latitude, "lng": longitude] var request = URLRequest(url: url) request.httpMethod = "POST" request.addValue("application/json", forHTTPHeaderField: "Content-type") guard let httpBody = try?…
0
votes
1 answer

Handle Timeout in Alamofire

I want to handle timeout error with Alamofire as follow. User initiate request with button press If timeout occurs then it will display message with custom view with 2 buttons (cancel & retry) if user presses retry_button the request should…
nirav
  • 573
  • 5
  • 20
0
votes
0 answers

Refresh Token with Alamofire retry count and retry request swift

I am using Alamofire to integrate API calls, handling error code and specially status code error like 401 and 403. I have also created the getRefreshToken() function, if error comes it will refresh the token. Problem I am facing about…
Tekhe
  • 149
  • 1
  • 12
0
votes
2 answers

Get string value of Alamofire AFError error Swift

I'm making a request to my server with AlamoFire, and I have a setup something like this, where "self.error" is a String variable. session.request("https://localhost:3000/my-route", method: .post, parameters: parameters,…
Evan
  • 1,892
  • 2
  • 19
  • 40
0
votes
1 answer

How to fix the Alamofire 5 error for success and failure cases in swift?

In my project, I am using Alamofire 5.9.3 and below is the uploading the data into the server. APISessionController.sharedInstance.sessionManager().upload(multipartFormData: { (multipartFormData) in for (key, value) in…
HariKarthick
  • 1,369
  • 1
  • 19
  • 47
0
votes
1 answer

unable to resume download from resumeData: Alamofire

i am using Alamofire 5.4.1 to cancel a download request and save the data to a file. which is then copied to a different folder. I later try and resume the task to download with the data loaded from the file in the new location and i get an error…
random_user
  • 73
  • 1
  • 6
0
votes
1 answer

suspend and resume alamofire download request - large file

I'm using Alamofire to download large files in my ios project. When i cancel a download request (that is currently downloading a large file to disk) - this request produces resumeData with the data downloaded so far - but I would like a responseURL…
random_user
  • 73
  • 1
  • 6
0
votes
1 answer

Alamofire assertionFailure - needNewBodyStream did not find UploadRequest

I'm trying to send a POST request using alamofire. but on a request i'm keeping get this error: assertionFailure("needNewBodyStream did not find UploadRequest.") Alamofire/SessionDelegate.swift, line 178 2020-12-09 16:48:32.746737+0330…
Mehrdad
  • 1,050
  • 1
  • 16
  • 27
0
votes
1 answer

iOS Alamofire - Streaming JSON lines first response issue

Using Alamofire 4.9.0. I am trying to implement handling streaming APIs in JSON lines format. Here's how: stream = Alamofire.request(url, method: HTTPMethod.get, headers: TTSessionManager.headers) .validate() …
UrosMi
  • 383
  • 1
  • 3
  • 11
0
votes
1 answer

Alamofire form-data” parameters type post request

I am trying to make a request with form-data as in Postman, however I always get the "Parameters is invalid" response from the server. I tried with postman it works perfectly. parameters: [String: String] = ["name": "name","email": "email"] Here is…
Ahmad
  • 1
0
votes
2 answers

Issue when loading Data in UITable - Data refresh only after second click

I have an issue bellow. I would like when I push on the refresh button to refresh the data contain in my UITable. So I have an alamofire function that do a GET to my server et the data is used for populate the table. The issue is that the…
jo7332
  • 9
  • 2
0
votes
1 answer

Alamofire request not sending post parameter

I am trying to create an Alamofire request as follows: //creating parameters for the post request let parameters: Parameters=[ "modelo": modelo_id ] let url_dispo = URL(string: "https://../calcular_precio.php") …
mvasco
  • 4,965
  • 7
  • 59
  • 120
0
votes
1 answer

Swift 5.1 & Alamofire 5.1 : GET method ERROR

when passing header and params: Alamofire.AFError.URLRequestValidationFailureReason.bodyDataInGETRequest(0 bytes) AF.request(urlString,method:.get, parameters: parameters, encoding: URLEncoding.httpBody, headers: headers).responseJSON { response…
LeNI
  • 1,184
  • 2
  • 10
  • 19
0
votes
1 answer

Alamofire 5 POST method having array parameters usage with swift 5

I am working on an iOS project with Swift 5 with Almofire 5.0.2. I tried all the options suggested on an online thread similar to this but it looks like I am still missing something. I am facing difficulty in during a POST method API call with an…
0
votes
2 answers

Breakpoint exception when executing request AF5

So I'm trying to check if the bearer is valid before before each request, but when I run the refresh token request Alamofire gets an exception on dispatch precondition: What am I doing wrong? is this even possible? extension Session:…