Click here to Skip to main content
15,897,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to call a web service to upload some image data to the server. I have to send the data 5 times to the server. This piece of code is written in a function which is called after 10 seconds duration by a timer. Now the problem is that the response of Web service might be late and second call to web service might initiate. I want to keep them in queue so that when one finishes other is called. I think I am not going in right way. I just want to maintain a queue in which I can call the web service multiple times and make different async calls to the server. Basically how I could call multiple async tasks.

Any help will be appreciated.

dispatch_queue_t myQueue;
myQueue = dispatch_queue_create("My Queue",NULL);
 dispatch_async(myQueue, ^{
                               [self uploadDataToServer];
                                dispatch_async(dispatch_get_main_queue(), ^{
                                    // Update the UI

                                });
                            });
Posted
Updated 26-Feb-15 0:14am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900