NSOperationQueue 用于同步上传

发布于 2024-12-19 06:56:30 字数 100 浏览 2 评论 0原文

正在开发一个 iPad 应用程序,它将大量文件同步上传到服务器。我想使用 NSOperationQueue 将每个上传请求添加到队列中,并在收到响应后开始处理下一个请求。如何做到这一点?

Am developing an iPad application which uploads bulk of files to the server synchronously. I would like to use NSOperationQueue to add each upload request into the queue and start processing the next request after receiving the response. How this can be done?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

黎歌 2024-12-26 06:56:30

通过 setMaxConcurrentOperationCount: 调用将 NSOperationQueue 的最大并发操作设置为 1。在这种情况下,只有前一个操作完成(即在您的情况下收到响应),队列才会处理下一个操作。

set maximum concurrent operation to 1 for NSOperationQueue by setMaxConcurrentOperationCount: call. In this case the queue will process next operation only if the previous one will be finished (i.e. in your case received the response).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文