thể trùng lặp:
performSelector may cause a leak because its selector is unknownperformSelector ARC cảnh báo
Tôi có mã này trong phi ARC mà làm việc mà không có lỗi hoặc cảnh báo:
- (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
}
}
Tuy nhiên, sau khi tôi chuyển thành dự án thành ARC, tôi nhận được cảnh báo này:
"Thực hiện Bộ chọn có thể gây rò rỉ vì bộ chọn của nó không xác định."
Tôi sẽ đánh giá cao ý tưởng về cách sửa đổi mã của mình cho phù hợp ..
Cảm ơn Rob. Bạn có biết nếu có một Radar trên này? David –
Có thể có liên quan: http://stackoverflow.com/questions/11875900/crash-in-objc-retain-in-method-performed-with-performselector – Jessedc
@DavidDelMonte Tôi chưa gửi một radar cho nó. Tôi không biết những gì bất cứ ai khác có thể đã gửi. –