如果互联网连接丢失,NSURLSession的数据任务是否会在后台自动恢复?
如果最初没有互联网,NSURLSession是否会自动尝试完成任务,或者会话是否因错误而返回?
解决方法 看起来你需要处理重试.When any task completes,the NSURLSession object calls the delegate’s
URLSession:task:dIDCompleteWithError: method with either an error
object,or nil if the task completed successfully. If the task is a
resumable download task,the NSError object’s userInfo dictionary
contains a value for the NSURLSessionDownloadTaskResumeData key. Your
app should use reachability APIs to determine when to retry,and
should then call downloadTaskWithResumeData: or
downloadTaskWithResumeData:completionHandler: to create a new download
task to continue that download. Go to step 3 (creating and resuming
task objects).
https://developer.apple.com/library/ios/documentation/cocoa/Conceptual/URLLoadingSystem/NSURLSessionConcepts/NSURLSessionConcepts.html
总结以上是内存溢出为你收集整理的ios – NSURLSession何时运行?全部内容,希望文章能够帮你解决ios – NSURLSession何时运行?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)