我真的不想要一个timeoutInterval,因此在离线时总是可以使用缓存,但我也不能将其删除。有没有办法将其设置为无限制?
var requestObj = NSURLRequest(URL: url!, cachePolicy: NSURLRequestCachePolicy.ReturnCacheDataElseLoad, timeoutInterval: 5);
答案 0 :(得分:3)
简单
var requestObj = NSURLRequest(URL: url!, cachePolicy: NSURLRequestCachePolicy.ReturnCacheDataElseLoad, timeoutInterval: Double.infinity);
答案 1 :(得分:0)
var requestObj = NSURLRequest(URL:url !, cachePolicy:NSURLRequestCachePolicy.ReturnCacheDataElseLoad,timeoutInterval:Double.greatestFiniteMagnitude)