Last active
November 1, 2022 06:06
-
-
Save vigneshr89/c35e324632f10f636780 to your computer and use it in GitHub Desktop.
NSURLSession Background service steps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For a background download service with NSURLSession | |
1. Create a download task with background session configuration with NSURLSession delegates. | |
2. If, application is in foreground NSURLsession delegate will be called directly. | |
3. If application is background or killed additional methods are needed in the app delegate . | |
4. "handleEventsForBackgroundURLSession" will be called first, where it is necessary to reinstate the session object with the delegate again. Otherwise delegate methods will not be called. | |
5. "URLSessionDidFinishEventsForBackgroundURLSession" will be called once everything is done. You can decide what you want to do once the download is complete like updating the UI. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment