gpt4 book ai didi

swift - 应用程序挂起时是否应取消 OperationQueue 执行?

转载 作者:行者123 更新时间:2023-11-28 14:54:18 25 4
gpt4 key购买 nike

我感兴趣的是,当应用收到UIApplicationWillResignActive通知时,是否需要在OperationQueue中调用.cancelAllOperations()

最佳答案

应用进入后台后很可能会进入挂起状态:

The app is in the background and executing code. Most apps enter this state briefly on their way to being suspended.

Apple documentation告诉我们后台状态是一个临时状态,从这个状态它只能进入暂停状态,这意味着您的应用程序中的任何代码都不会被执行。

这意味着您入队的任何操作也被“暂停”。如果操作在一段时间后“恢复”时 react 不佳,您可以取消它们,否则您可以保持不变。

关于swift - 应用程序挂起时是否应取消 OperationQueue 执行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49543218/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com