I'm writing a simple button class, something like this:
@interface MyButton : NSObject {
id object;
SEL action;
}
@property(strong) id object;
@property SEL action;
-(void)fire;
@end
@implementation MyButton
@synthesize object, action;
-(void)fire {
[object performSelector:action];
}
@end
I get the following warning from Clang on [object performSelector:action]
:
PerformSelector may cause a leak because its selector is unknown
After some research I see that selectors can belong to families which have different memory requirements. The intention is for the action to return void, so it shouldn't cause any ARC difficulties and should fit in the none
family.
It looks like the relevant piece of preprocessor code I want is, or is a variant of:
__attribute__((objc_method_family(none)))
But where do I put that to tell Clang not to worry?