我想确定用户是否在 Preferences 应用程序中关闭了 Background Fetching。如果他将其关闭,我的应用程序将无法运行。
问问题
741 次
1 回答
6
这是执行此操作的代码:
if ([[UIApplication sharedApplication] backgroundRefreshStatus] == UIBackgroundRefreshStatusAvailable) {
NSLog(@"Background fetch is available for the app.");
}else if([[UIApplication sharedApplication] backgroundRefreshStatus] == UIBackgroundRefreshStatusDenied)
{
NSLog(@"Background fetch for this app or for the whole system is disabled.");
}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.");
}
于 2013-11-01T20:30:05.153 回答