On an iPhone project I have an NSOperationQueue, which handles communication to a server, on my appDelegate object and an upload job as following:
@interface UploadOperation : NSOperation
- (id)initWithItem:(NSDictionary*)anItem;
@end
I’m pushing items, with the user’s request, to the NSOperationQueue which fire the upload. Everything works great, but I want to prevent the same upload operation to occur more then 1 time.
In other words, if the upload was not finish, don’t push the same item to the upload queue.
Is it possible with NSOperationQueue methods or I’ll have to manage it by my own with an “items currently on queue” array?
You are correct, you need to manage it by using your own array of items that are currently on the queue: