AlamoFire does not respect timeout interval

前端 未结 6 1898
离开以前
离开以前 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:21

    Here's the Swift 3.0 / Alamofire 4.0 code to get an alamofireManager that has a 5 second timeout:

        let configuration = URLSessionConfiguration.default
        configuration.timeoutIntervalForResource = 5 // seconds
    
        let alamofireManager = Alamofire.SessionManager(configuration: configuration)
    

提交回复
热议问题