我的应用程序在后台运行时出现问题。 应用程序进入后台 3 分钟后出现此错误:
Background task expired while holding WebKit ProcessAssertion.
有人可以帮助我吗?
提前致谢。
最佳答案
委托(delegate)“applicationDidEnterBackground:”
方法有大约 5 秒的时间来完成所有任务并返回。
如果您在主线程上执行任何需要超过 5 秒的任务.. 然后你会得到错误。
像这样在后台线程中尝试该方法。
-(void) method
{
UIBackgroundTaskIdentifier taskId = 0;
taskId = [application beginBackgroundTaskWithExpirationHandler:^{
taskId = UIBackgroundTaskInvalid;
// Perform your task
}];
}
关于ios webview流后台模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38479858/