1
votes

I write next. All code wrote with ARC

@interface MPEvent : UIImageView
@property (nonatomic, unsafe_unretained) SEL action;
@property (nonatomic, strong) id target;

@end

Is selector declared in correct way?

In implementation I use my properties next this way:

- (void)sendActionToTargetFromView:(id)view {
    [target performSelector:action withObject:view];
}

But compiler show me a warning
warning: Semantic Issue: PerformSelector may cause a leak because its selector is unknown

How to fix this warning?

1

1 Answers

5
votes

In the below example -Warc-performSelector-leaks is ignored for only a single line of code, after which the diagnostics return to whatever state had previously existed.

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
    [self.ticketTarget performSelector: self.ticketAction withObject: self];
#pragma clang diagnostic pop

pragma warnings help
Detailed description