Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pause,Resume,Cancel Upload Task Using NSURLSession UploadTask

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

like image 655
Tabish Sohail Avatar asked Jan 07 '15 06:01

Tabish Sohail


1 Answers

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.

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

It might help someone working on uploadTask using NSURLSession.

like image 129
Tabish Sohail Avatar answered Nov 08 '22 02:11

Tabish Sohail