How do I use NSOperationQueue with NSURLSession?

前端 未结 7 977
别跟我提以往
别跟我提以往 2020-12-04 06:48

I\'m trying to build a bulk image downloader, where images can be added to a queue on the fly to be downloaded, and I can find out the progress and when they\'re done downlo

7条回答
  •  悲哀的现实
    2020-12-04 06:57

    If you're using OperationQueue and don't want each operation to create many simultaneous network requests, you can simply call queue.waitUntilAllOperationsAreFinished() after each operation is added to the queue. They will now only execute after the previous one is completed, significantly reducing the amount of simultaneous network connections.

提交回复
热议问题