Detecting user settings for Background App Refresh in iOS 7 Detecting user settings for Background App Refresh in iOS 7 objective-c objective-c

Detecting user settings for Background App Refresh in iOS 7


this is what you are looking for.

if ([[UIApplication sharedApplication] backgroundRefreshStatus] == UIBackgroundRefreshStatusAvailable) {    NSLog(@"Background updates are available for the app.");}else if([[UIApplication sharedApplication] backgroundRefreshStatus] == UIBackgroundRefreshStatusDenied){    NSLog(@"The user explicitly disabled background behavior for this app or for the whole system.");}else if([[UIApplication sharedApplication] backgroundRefreshStatus] == UIBackgroundRefreshStatusRestricted){    NSLog(@"Background updates are unavailable and the user cannot enable them again. For example, this status can occur when parental controls are in effect for the current user.");}


Updated for Swift 3 and iOS10:

switch UIApplication.shared.backgroundRefreshStatus {case .available:    print("Refresh available")case .denied:    print("Refresh denied")case .restricted:    print("Refresh restricted")}


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.