AlamoFire does not respect timeout interval

前端 未结 6 1882
离开以前
离开以前 2021-02-01 14:03
class APIClient {
    var user = User()
    let alamoFireManager : Alamofire.Manager?
    let center = NSNotificationCenter.defaultCenter()


    init(){
        let con         


        
6条回答
  •  清酒与你
    2021-02-01 14:32

    I got NSURLErrorDomain when I used above method . This is my code (swift 3.2/Alamofire 4.4)

        let manager = Alamofire.SessionManager.default
        manager.session.configuration.timeoutIntervalForRequest = 4
    
        manager.request(.POST, CONSTANTS.APIEndpoint+"/test", parameters: parameters).responseJSON {
                        (req, res, json, error)  in
                        if let json = self.handleAPIResponse(req, res: res, json_data: json, error: error){
                        }
    

提交回复
热议问题