implementing long-running background tasks
for tasks that require more execution time to implement, you must request specific permissions to run them in the background without their being suspended. In ios, only specific app types are allowed to run in the background:
Apps that play audible content to the user while in the background, such as a music player app
apps that keep users informed of their location at all times, such as a navigation app
apps that support voice over internet protocol (voip)
newsstand apps that need to download and process new content
apps that receive regular updates from external accessories
apps that implement these services must declare the services they support and use system frameworks to implement the relevant aspects of those services. Declaring the services lets the system know which services you use, but in some cases it is the system frameworks that actually prevent your application from being suspended.
Declaring your app’s supported background tasks
support for some types of background execution must be declared in advance by the app that uses them. An app declares support for a service using its info.plist file. Add the uibackgroundmodes key to your info.plist file and set its value to an array containing one or more of the following strings:
Audio—the app plays audible content to the user while in the background. (this content includes streaming audio or video content using airplay.)
location—the app keeps users informed of their location, even while it is running in the background.
Voip—the app provides the ability for the user to make phone calls using an internet connection.
Newsstand-content—the app is a newsstand app that downloads and processes magazine or newspaper content in the background.
External-accessory—the app works with a hardware accessory that needs to deliver updates on a regular schedule through the external accessory framework.
Bluetooth-central—the app works with a bluetooth accessory that needs to deliver updates on a regular schedule through the core bluetooth framework.
Bluetooth-peripheral—the app supports bluetooth communication in peripheral mode through the core bluetooth framework.