0

我正在尝试在应用程序状态为后台时打印后台剩余时间。我正在尝试读取后台剩余时间以在触发后台获取时执行某些任务。

这是我的代码:-

UIApplicationState appState = [[UIApplication sharedApplication] applicationState];

NSString *appStateString;

switch (appState) {
    case UIApplicationStateBackground:
        appStateString = [NSString stringWithFormat: @"background %.02f seconds remaining", [UIApplication sharedApplication].backgroundTimeRemaining];
        break;
}

当我打印 appStateString 的值时,我看到:-

background 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.00 seconds remaining

根据 Apple 的文档,它说“当应用程序在前台运行时,此属性中的值仍然适当大”

但在我的情况下,应用程序在后台运行。那么为什么这个值会这么大呢?请建议

4

0 回答 0