Search code examples
iphoneobjective-cipadxcode5application-settings

Take User to Background Refresh Settings programmatically in iOS


In my app I am checking Background Refresh Settings is enabled or not. If not enabled i want that app will open the Setting option and take user to Background Refresh options. Is it possible to do programmatically?


Solution

  • I guess you want to do something like that ?

    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.");
    }