I've created a custom subclass of NSOperation and I've overwritten the main
method.
@interface WGTask : NSOperation
@property(readonly) BOOL isExecuting,isFinished;
@end
@implementation WGTask
@synthesize isExecuting,isFinished;
- (void)start {
...
[self willChangeValueForKey:@"isFinished"];
isFinished=YES;
[self didChangeValueForKey:@"isFinished"];
...
}
@end
But this code raises an EXC_BAD_ACCESS error. Removing [self didChangeValueForKey:@"isFinished"]
and [self willChangeValueForKey:@"isFinished"]
solves the problem, but even if the isFinished
value is correctly updated, the NSOperationQueue doesn't remove the operation!