我有MyOperation : NSOperation
课@property (nonatomic, retain) NSString *oID;
有时我需要取消特定的操作oID
。我正在尝试这样做:
NSArray *operations = operationQueue.operations;
NSPredicate *predicate = [NSPredicate predicateWithFormat:[NSString stringWithFormat: @"oID == %@", _specificID]];
NSArray *arrayOperations = [operations filteredArrayUsingPredicate: predicate];
并得到错误:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse the format string "oID == 0f5db97b-f127-4425-ad79-451d1f204016"'
是否可以从 NSOperationQueue 中过滤操作?