在iOS中以编程方式将用户带到后台刷新设置

时间:2013-11-25 07:30:08

标签: iphone objective-c ipad xcode5 application-settings

在我的应用中,我正在检查后台刷新设置是否已启用。如果未启用,我希望该应用程序将打开“设置”选项并将用户带到“后台刷新”选项。 是否可以以编程方式进行?

1 个答案:

答案 0 :(得分:2)

我想你想做那样的事情?

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