Receive data in same order as that of NSOperationQueue
Posted
by
Nishit
on Stack Overflow
See other posts from Stack Overflow
or by Nishit
Published on 2011-01-05T16:30:09Z
Indexed on
2011/01/06
11:53 UTC
Read the original article
Hit count: 400
iphone
|nsoperationqueue
Hi, I have an NSOperationQueue, in which I keep on adding NSOperation objects that hit server and brings data. Is there a way to store the received data in the order in which they were fired? For example, suppose the A, B and C objects are added in NSOperationQueue in the order ABC. Now each of the three A, B and C will bring data in their corresponding threads. I want to store the results in the same order in an array so that the contents of array becomes "Result A", "Result B" and "Result C". Please provide a solution or a direction towards the right answer for this problems. Thanks Guys
Basically, I want to design an autosuggest component which brings data from server (same as in google app), and I thought NSOperationQueue to be the best method to implement this. Currently I set the maxConcurrentOperationCount to 1, but I want to set it to more than 1, as data comes from the server very slowly. Please point out the right dolution or direction towards this question. Thanks
© Stack Overflow or respective owner