Question

Here's my problem. Im using

[NSURLConnection sendAsynchronousRequest:request queue:_queue completionHandler:
^(NSURLResponse *response, NSData *data, NSError *error) {}];

to send a request to the server. The queue is the same for every request since the class that does this is a singleton. The thing is in a certain point i am sending a second request before the first one finished and i want it to wait for the first one to finish, so what i want is a way to make the queue serial. The second request should still be asynchronous, so even tho it waits I want the main thread to keep running so the user can interact with the application

Was it helpful?

Solution

Set maxConcurrentOperationCount on the _queue to 1 to limit the queue to only executing a single operation at a time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top