swift 2.1 alamofire timeout method

十年热恋 提交于 2019-12-05 07:10:59

Based on NSURLSessionConfiguration Class Reference

This property determines the request timeout interval for all tasks within sessions based on this configuration. The request timeout interval controls how long (in seconds) a task should wait for additional data to arrive before giving up. The timer associated with this value is reset whenever new data arrives. When the request timer reaches the specified interval without receiving any new data, it triggers a timeout.

Timer is reset whenever new data arrives and that is why you have different error time.

Also you could set one more parameter for the request :

manager.session.configuration.timeoutIntervalForResource = 5
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!