I want to know if the superclass implements method A from my subclass, which also implements method A, so that I can safely call [super A] from my subclass without getting an exception.
NSObject's respondsToSelector: doesn't work in this case, since that will always return true (because my subclass implements the method in question). Any ideas?
You can use the class method instancesRespondToSelector:
to do this. So from the subclass you can call [[self superclass] instancesRespondToSelector:@selector(...)]
to determine if the superclass implements the method you require.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With