1
votes

I am using below code to create background session for huge uploads,

NSURLSessionConfiguration *config = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:identifier];

NSURLSession *session = [NSURLSession sessionWithConfiguration:config delegate:delegate delegateQueue:nil];

and save the identifier to re-associate with the session later. But once app goes to background and terminated by OS then, upon relaunch I am not receiving any callbacks from that session even if I use same identifier to create session. It always creates new session that has no ongoing upload task.

The previous task can't finish this early as I have GBs to upload.

Am I missing anything here ? any additional setting etc.

1
How are you determining that the task successfully started and that it wasn't still going after the app resumed?Marcus Adams
@MarcusAdams after starting the upload, i was getting upload progress before app went into the background. When resumed, if app was only suspended, then it continues giving me progress. But if app was terminated by OS and relaunched then there are no callbacks from session.nmhmd

1 Answers

0
votes

Save the delegate as well in order to receive the call backs! The instance of the delegate is not retained after the App kill.

Make your delegate comply to NSCoding protocol and do the archiving and unarchiving!

Cheers:)