为什么应用自动后台刷新?

时间:2016-03-01 04:13:43

标签: ios background

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

使用此代码检查应用状态: 该应用程序总是进入UIBackgroundRefreshStatusAvailable,并且没有设置任何"背景模式" in capabilities(和info.plist)。

任何人都可以回答这个问题,谢谢。

1 个答案:

答案 0 :(得分:0)

backgroundRefreshStatus属性仅镜像当前用户的设备设置,并且与您设置的info.plist模式无关