Krishnakanth Kesana
Krishnakanth Kesana

Reputation: 17

NSURLSessionDownloadTask resume and Pause from other View ios

I have small problem with NSURLSessionDownloadTask, i.e., in my app user can download movies(nearly 1 Gb), if the user click Pause button and get back to the previous viewController then again he wants to resume the download the downloaded percentage goes to 0. Can anyone please tell how to declare that in AppDelegate.m, or else tell how to resume that video from any viewController and After re-launch that app...

thanks in Advance...

Upvotes: 0

Views: 352

Answers (1)

Duncan C
Duncan C

Reputation: 131398

Welcome to SO. In general if you have a specific problem you should provide enough code from your project so your readers understand what you are doing now.

In your case we need information on how your view controllers are linked.

What I would suggest for you is to create a separate download manager singleton class. Set it up with a delegate. Define a delegate protocol that lets you get progress updates on the download percentage. Also implement a pause method.

Both your view controllers would reference the singleton.

If you need to manage multiple downloads from different client objects at the same time then your design becomes more complicated. In that case you might want to look at third party libraries like AFNetworking. They handle a lot of this sort of thing for you.

Upvotes: 1

Related Questions