Ios Background App Extension
So whether you re using one of the built in apps or one of the over 1 4 mil.
Ios background app extension. You might also be wondering why we have the task handling code in the app delegate and not scene delegate. The xcode project for the app enables the background fetch capability and the app requests hourly updates at launch time. In ios your app extension might need a bit more time to complete a potentially lengthy task such as uploading content to a website.
None of these were a viable solution they are unreliable and ultimately against apple s intended share extension design. Listing 1 fetching data from a server in the background. The simplest way to perform backgrounding on ios is to break your backgrounding requirements into tasks and run the tasks in the background.
Ios is missing the concept of custom background service that apps and. When this is the case you can use the nsurlsession class to initiate a transfer in the background. In ios 13 i wasn t able to get my app to call that delegate method at all so i figured i needed to use the scene delegate instead.
When it receives execution time the app checks to see if new data is available. Tasks are under a strict time limit and typically get about 600 seconds 10 minutes of processing time after an application has moved to the background on ios 6 and less than 10 minutes on ios 7. Applicationdidenterbackground is the old api for the old lifecycle of apps prior to ios 13.
Because a background transfer uses a separate process the transfer can continue as a low priority task after your extension completes the host app s request and gets terminated.