gpt4 book ai didi

background - 如何检查是否在 iOS 上启用了 BackgroundFetching?

转载 作者:行者123 更新时间:2023-12-05 00:27:53 26 4
gpt4 key购买 nike

我喜欢确定用户是否在首选项应用程序中关闭了后台获取。如果他关闭它,我的应用程序将无法运行。

最佳答案

这是执行此操作的代码:

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

关于background - 如何检查是否在 iOS 上启用了 BackgroundFetching?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19734665/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com