We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
Mark R.5
9 years agoHelpful | Level 5
Background Session for NSURLSession in iOS
I am after a little advice on background/foreground session usage. The documentation states that by default, background sessions are used for uploads and download. As I understand it, this means that...
Mark R.5
9 years agoHelpful | Level 5
Hi Greg,
I think part of my query does actually relate directly to the framework. If you read the 'Background Transfer Considerations' section in Apple's documentation:
then it explains what an app should do in the event that a transfer completes when the app is not running. Specifically:
----------------------------------
In iOS, when a background transfer completes or requires credentials, if your app is no longer running, iOS automatically relaunches your app in the background and calls the application:handleEventsForBackgroundURLSession:completionHandler: method on your app’s UIApplicationDelegate object. This call provides the identifier of the session that caused your app to be launched. Your app should store that completion handler, create a background configuration object with the same identifier, and create a session with that configuration object. The new session is automatically reassociated with ongoing background activity. Later, when the session finishes the last background download task, it sends the session delegate a URLSessionDidFinishEventsForBackgroundURLSession: message. In that delegate method, call the previously stored completion handler on the main thread so that the operating system knows that it is safe to suspend your app again.
In both iOS and OS X, when the user relaunches your app, your app should immediately create background configuration objects with the same identifiers as any sessions that had outstanding tasks when your app was last running, then create a session for each of those configuration objects. These new sessions are similarly automatically reassociated with ongoing background activity.
------------------------------------
Since the Dropbox framework manages the sessions, then does it also deal with the fiddling around described above or is that left up to the app?
Greg-DB
Dropbox Community Moderator
9 years agoI'm checking in with the team to get some information on the specifics of this in the Dropbox SDK. Thanks in advance for your patience.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!