草庐IT

ios - performFetchWithCompletionHandler 永远不会被解雇

coder 2023-04-25 原文

1)我的plist配置提供backgroundmode:

<key>UIBackgroundModes</key>
<array>
    <string>fetch</string>
</array> 

2) 在 didFinishLaunchingWithOptions 我有:

[[UIApplication sharedApplication] setMinimumBackgroundFetchInterval:1.0];

3) 我在委托(delegate)中声明了协议(protocol)UIApplicationDelegate

4) 我实现了以下方法,但它从未被触发。 (仅当我使用“XCode->Debug->Simulate Background Fetch”模拟提取时才有效。)

-(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler

为什么?这是 DP5 测试版错误吗?我应该雷达吗?

最佳答案

在 iOS 模拟器中运行您的应用,在 Xcode Debug模式下,您可以从 Xcode 菜单强制执行后台获取:

调试 > 模拟后台获取

可能适用于系留设备,我最近没有尝试过。

关于ios - performFetchWithCompletionHandler 永远不会被解雇,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18315771/

有关ios - performFetchWithCompletionHandler 永远不会被解雇的更多相关文章

随机推荐