문제

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

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top