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