I am using AFNetworking in an app I am developing. For downloading requests, I am ussing AFHTTPRequestOperation's setCompletionBlockWithSuccess:failure. This ties a success block and and a failure block to an operation, and the operation is then added to an NSOperationQueue using addOperation.
AFNetworking creates an asynchronous thread and runs all the data there. However, I'd like to add three operations to a concurrent thread, whereby they run synchronously. Also known as a serial queue in GCD. How can I achieve that in AFNetworking? Should I create my own serial queue and then addOperation in that queue, moving all the request initialization, success block, failure block and adding under the serial queue?
Setting the NSOperationQueue maxConcurrentOperationCount property to 1 effectively creates a serial queue. You can then be assured each request will complete before the next operation is triggered.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With