7
可能重复:
performSelector may cause a leak because its selector is unknownperformSelector ARC警告
我在非ARC这段代码中没有错误或警告的工作原理:
- (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
}
}
然而,当我转换为ARC项目,我得到这个警告:
“执行选择器可能会导致泄漏,因为其选择器未知。”
我将不胜感激就如何修改我的代码,相应的想法..
感谢罗布。你知道这是否有雷达?大卫 – 2012-08-10 04:36:55
可能是相关的:http://stackoverflow.com/questions/11875900/crash-in-objc-retain-in-method-performed-with-performselector – Jessedc 2012-08-10 04:49:22
@DavidDelMonte我还没有提交它的雷达。我不知道其他人可能提交了哪些雷达。 – 2012-08-11 18:00:07