Hello,
In my application, I create NSOperationsand I add them to NSOperationQueue. Sometimes I want to undo some specific operations from my operation queue, so I defined an identifier property for my NSOperation subclass:
@property (nonatomic, assign) NSString *identifier;
But when I get stuck on my operations with the queue, and I want to compare my operation identifier with the identifier of the operation I want to receive, I got EXC_BAD_ACCESSit by indicating the if condition:
for (MyCustomNSOperationClass *operation in self.myOperationQueue.operations)
{
NSString *identifier = [self getRelatedIdentifier];
if ([operation.identifier isEqualToString:identifier])
{
[operation cancel];
}
}
The operation id should be something like 33a37fb0-8f77-0132-6c0b-5254005d9147, but when it fails, it is something like 0x7be4af00(when I use po operation.identifier). I say when it fails, because it does not always crash and when it does not fall, then the identifier is correct (I'm not sure if this is super clear ...).
NSOperation, , , ?
!