Set timeout in Alamofire

后端 未结 14 1282
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-01 03:33

I am using Alamofire 4.0.1 and I want to set a timeout for my request. I tried the solutions gived in this question:

In the first case

14条回答
  •  醉酒成梦
    2020-12-01 04:15

    i have code for swift 2.3 hope it helps you, try it

        let configuration = NSURLSessionConfiguration.defaultSessionConfiguration()
        configuration.timeoutIntervalForResource = 10800 // seconds
        configuration.timeoutIntervalForRequest = 10800 // seconds
    
        alamoFireManager = Alamofire.Manager(configuration: configuration)
    

提交回复
热议问题