1

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?

Rayfleck
  • 12,116
  • 7
  • 44
  • 72
rowwingman
  • 5,528
  • 7
  • 31
  • 50
  • 2
    Possible answer here: http://stackoverflow.com/questions/7017281/performselector-may-cause-a-leak-because-its-selector-is-unknown – Audun Kjelstrup Jan 26 '12 at 15:36

1 Answers1

5

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

Community
  • 1
  • 1
rowwingman
  • 5,528
  • 7
  • 31
  • 50