Detecting user settings for Background App Refresh in iOS 7

前端 未结 3 775
南旧
南旧 2020-12-12 16:12

Starting with iOS 7, Apple\'s Multitasking APIs allow apps to run in three new Background Modes: Background fetch, Remote notification content, and Background transfer servi

3条回答
  •  南笙
    南笙 (楼主)
    2020-12-12 17:07

    Check UIApplication's backgroundRefreshStatus property. The following is quoted from apple document.

    This property reflects whether the app can be launched into the background to handle background behaviors, such as processing background location updates and performing background fetches. If your app relies on being launched into the background to perform tasks, you can use the value of this property to determine if doing so is possible and to warn the user if it is not. Do not warn the user if the value of this property is set to UIBackgroundRefreshStatusRestricted; a restricted user does not have the ability to enable multitasking for the app.

提交回复
热议问题