当我在 Xcode 的 Debug 选项卡中使用 Simulate Background Fetch 时,我的应用程序执行了预期的操作,但是,当应用程序在我的手机上运行时,没有任何效果。
以前有人发生过这种情况吗?你是怎么解决的?
我目前正在使用 Swift 2.2 和 Xcode 7.3
当我在 Xcode 的 Debug 选项卡中使用 Simulate Background Fetch 时,我的应用程序执行了预期的操作,但是,当应用程序在我的手机上运行时,没有任何效果。
以前有人发生过这种情况吗?你是怎么解决的?
我目前正在使用 Swift 2.2 和 Xcode 7.3
您是否在运行模式下为Launch due to a Background Fetch Event
iOS 不允许任何应用程序在后台运行,除非应用程序要求它,并且它只允许它运行 10 分钟以注册后台执行:
- (void)applicationDidEnterBackground:(UIApplication *)application {
UIBackgroundTaskIdentifier identifier;
identifier = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
[[UIApplication sharedApplication] endBackgroundTask:identifier];
}];
}