Possible Duplicate:
performSelector may cause a leak because its selector is unknown
I have this code in non-ARC that works without errors or warnings:
- (void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents
{
// Only care about value changed controlEvent
_target = target;
_action = action;
}
- (void)setValue:(float)value
{
if (value > _maximumValue)
{
value = _maximumValue;
} else if (value < _minimumValue){
value = _minimumValue;
}
// Check range
if (value <= _maximumValue & value >= _minimumValue)
{
_value = value;
// Rotate knob to proper angle
rotation = [self calculateAngleForValue:_value];
// Rotate image
thumbImageView.transform = CGAffineTransformMakeRotation(rotation);
}
if (continuous)
{
[_target performSelector:_action withObject:self]; //warning here
}
}
However, after I convert to project to ARC, I get this warning:
"Perform Selector may cause a leak because its selector is unknown."
I would appreciate ideas on how to revise my code accordingly..
The only way I've found to avoid the warning is to suppress it. You could disable it in your build settings, but I prefer to just use pragmas to disable it where I know it's spurious.
If you're getting the error in several places, you can define a macro to make it easier to suppress the warning:
You can use the macro like this: