alamofire-request

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

送分小仙女□ 提交于 2021-01-20 16:58:28
问题 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 once I logged in successfully. So after login, in each API, I'm appending the token in the header part. And when if the token is expired I will get 401. That time I need to auto-refresh the authentication token and recall the same API again. How

Alamofire parameter with multiple values in one Key

南楼画角 提交于 2020-01-26 04:53:22
问题 How to send parameter as alamofire parameter for the following data? data : {"username":"username","password":"password"} I want to achieve following through alamofire paramter, but I failed to achieve this. what I'm doing is: let parameter: Parameters = ["data": ["username": "\(textFieldUserName.text!)", "pass": "\(textFieldPassword.text!)"]] Alamofire.request(loginUrl, method: .post, parameters: parameter,encoding: JSONEncoding.default, headers: nil).responseJSON { response in but it is not