gpt4 book ai didi

ios - 如何暂停 NSOperationQueue 中的 NSOperation?

转载 作者:IT王子 更新时间:2023-10-29 08:19:59 24 4
gpt4 key购买 nike

我需要暂停插入到 NSOperationQueue 中的正在运行的 NSOperation。目前我正在取消所有操作并重新启动它们。但这会导致在已完成的流程方面出现某种重复。我尝试使用 NSOperationQueue 的 setSuspended 标志。但它并没有暂停操作。有什么出路吗?

最佳答案

看到这个:Link

这里来自 apple docs :

Suspending and Resuming Queues If you want to issue a temporary halt to the execution of operations, you can suspend the corresponding operation queue using the setSuspended: method.

Suspending a queue does not cause already executing operations to pause in the middle of their tasks. It simply prevents new operations from being scheduled for execution. You might suspend a queue in response to a user request to pause any ongoing work, because the expectation is that the user might eventually want to resume that work.

关于ios - 如何暂停 NSOperationQueue 中的 NSOperation?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11983625/

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