使用NSURLSession UploadTask暂停,恢复,取消上传任务 [英] Pause,Resume,Cancel Upload Task Using NSURLSession UploadTask

查看:430
本文介绍了使用NSURLSession UploadTask暂停,恢复,取消上传任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个使用NSURLSession上传多个文件的应用程序,现在我的文件已成功上传。但现在我想要实现的是暂停,恢复和取消上传,就像我们在下载任务中一样。可能吗。?任何帮助,将不胜感激。 Thnx

I am developing an app to upload multiple files using NSURLSession, right now my files are successfully uploaded. But now what i want to achieve is to pause,resume and cancel the uploads just like we do in download tasks. Is it possible.? Any help would be appreciated. Thnx

推荐答案

我已经研究了很多但却找不到任何东西。我在我的代码上尝试这个,假设这是一个下载任务,我我们知道我们可以使用NSURLSession暂停,恢复上传任务,就像下载任务一样。

I have studied alot but could find nothing .After i tried this on my code assuming this as a download task ,I came to know that we can "pause , resume" upload tasks as well using NSURLSession just we do in downloading tasks.

暂停任务只需调用 [yourUploadTask suspend];
恢复 [yourUploadTask resume];
取消 [ yourUploadTask cancel];

To pause a task simply call [yourUploadTask suspend]; to resume [yourUploadTask resume]; To cancel [yourUploadTask cancel];

它可能会帮助使用NSURLSession处理uploadTask的人。

It might help someone working on uploadTask using NSURLSession.

这篇关于使用NSURLSession UploadTask暂停,恢复,取消上传任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆