I have an nsoperation class where I want to store that running operation into nsuserdefaults for later reference. How do I do that? Please help.
Asked
Active
Viewed 345 times
1 Answers
0
NSOperation is not compliant to NSCoding. You will have to encode/decode it yourself. However, think about what you are trying to accomplish here. There must be something really special or really wrong for you to need to save an NSOperation.

J2theC
- 4,412
- 1
- 12
- 14
-
i wanted to get currently running operaton and cancel it, if a user click on cancel uploading button.. how do I achieve this? – Bharathi Jayakumar Oct 25 '12 at 09:48
-
You can cancel the operation from the NSOperationQueue using cancelAllOperations – J2theC Oct 25 '12 at 15:34
-
I want to cancel only one operation, that is currently running! Not all. As a workaround, I store currently running operation in the variable, and cancel it when required. First I thought I should store it in userdefaults, so that, even after, app terminated, it will be useful. Later realized that, it is not required.. Thanks anyway! :-) – Bharathi Jayakumar Oct 27 '12 at 08:24
-
AFNetworking's AFURLConnectionOperation (subclass of NSOperation) did conform to NSCoding, there is actually some case when archiving an operation does help. – zetachang Feb 15 '14 at 03:50