SSCheckBoxView
SSCheckBoxView copied to clipboard
PerformSelector may cause a leak because its selector is unknown
Getting the above warning on this line of code in the touchesEnded method:
[delegate performSelector: stateChangedSelector withObject:self];
I don't want to change anything just in case it causes more damage. I'm using XCode 5.1.
It shouldn't do any harm if you set the delegate and the selector correctly.
It's not in my code.. it's in your code; I'm afraid that it will become a build error in the not too distant future. Can you not correct it?
Just use the state changed block, don't use the delegate then.
SSCheckBoxView *cbv = ...
[cbv setStateChangedBlock:^(SSCheckBoxView *v) {
NSLog(@"checkbox state: %d", v.checked);
}];
I think we're not talking about the same code... this is the code in your SSCheckedBoxView.m, method is: touchesEnded: withEvent:
if (CGRectContainsPoint(validTouchArea, point)) {
checked = !checked;
[self updateCheckBoxImage];
if (delegate && stateChangedSelector) {
[delegate performSelector: stateChangedSelector withObject:self]; // <----warning here
}
else if (stateChangedBlock) {
stateChangedBlock(self);
}
}
The build warning is on the line indicated with <---warning here
I'll update it when I've time. For now just use the block and don't set the delegate.