Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/113.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS杀死了我的后台获取进程;创建不必要的崩溃日志?_Ios_Ios7 - Fatal编程技术网

iOS杀死了我的后台获取进程;创建不必要的崩溃日志?

iOS杀死了我的后台获取进程;创建不必要的崩溃日志?,ios,ios7,Ios,Ios7,我在iOS 7中使用了新的后台获取模式,在用户的崩溃日志中我看到了很多: MyApp[11893] has active assertions beyond permitted time: {( <BKProcessAssertion: 0x176afef0> identifier: Background Content Fetching (3281) process: MyApp[11893] permittedBackgroundDuration: 30.000000

我在iOS 7中使用了新的后台获取模式,在用户的崩溃日志中我看到了很多:

MyApp[11893] has active assertions beyond permitted time: 
{(
    <BKProcessAssertion: 0x176afef0> identifier: Background Content Fetching (3281) process: MyApp[11893] permittedBackgroundDuration: 30.000000 reason: backgroundContentFetching owner pid:33 preventSuspend  preventThrottleDownUI  preventIdleSleep  preventSuspendOnSleep 
)}
MyApp[11893]的活动断言超出了允许的时间:
{(
标识符:后台内容获取(3281)进程:MyApp[11893]permittedBackgroundDuration:30.000000原因:backgroundContentFetching所有者pid:33 preventSuspend preventThrottleDownUI PreventIDleLeep preventSuspendOnSleep
)}

我想我得到这个是因为我的更新时间超过了允许的30秒,因此被系统杀死。我无能为力,因为应用程序被操作系统杀死,所以我无法确保获取崩溃日志听起来合理

如果您想避免崩溃并优雅地失败,是的,监视
backgroundTimeRemaining
听起来是一个不错的解决方案

由于您无论如何都不会及时完成操作,因此最好自己终止它,而不是被操作系统杀死

根据

您的应用程序最多有30秒的挂钟时间来执行下载操作并调用指定的完成处理程序块


如果您使用http或ftp下载数据,您可以使用启动提取并立即调用完成处理程序,然后在下载完成后,iOS将重新唤醒您的应用程序。

使用30秒的nstimer也很好。。。假设“30秒”在未来不会改变..@ErbenMo这是我不会做的假设
backgroundtime剩余
正是出于这个原因。