From the docs for NSOperation:

... "An operation object is a single-shot object—that is, it executes its task 
once and cannot be used to execute it again." 


On Mar 5, 2011, at 10:33 PM, Shane wrote:

> I have an NSOperation object that has been placed in an
> NSOperationQueue. I then execute that NSOperation and all works
> normal.
> 
> What I'd like to do is then run that task again, however, when I do
> run it I get the following error when trying to add that object to the
> queue again.
> 
> Caught NSInvalidArgumentException*** -[NSOperationQueue
> addOperation:]: operation is finished and cannot be enqueued
> 
> I then see that the "NSOperationQueue Class Reference" says this about
> addOperation: ...
> "Similarly, this method throws an NSInvalidArgumentException exception
> if the operation is currently executing or has already finished
> executing."
> 
> So it has finished executing, and I'd like to know how to execute it
> again but w/o having to build a new object. Is there a way to rerun an
> NSOperation object, or should I do something else besides call
> addOperation: again?

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to