0

当我在 Xcode 的 Debug 选项卡中使用 Simulate Background Fetch 时,我的应用程序执行了预期的操作,但是,当应用程序在我的手机上运行时,没有任何效果。

以前有人发生过这种情况吗?你是怎么解决的?

我目前正在使用 Swift 2.2 和 Xcode 7.3

4

2 回答 2

1

您是否在运行模式下为Launch due to a Background Fetch Event

即使配置了正确的背景模式,iOS 背景提取也不起作用

于 2016-09-07T04:01:06.970 回答
0

iOS 不允许任何应用程序在后台运行,除非应用程序要求它,并且它只允许它运行 10 分钟以注册后台执行:

- (void)applicationDidEnterBackground:(UIApplication *)application {
    UIBackgroundTaskIdentifier identifier;
    identifier = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
        [[UIApplication sharedApplication] endBackgroundTask:identifier];
    }];
}
于 2016-09-07T05:20:06.227 回答