I have a class which uses resolveInstanceMethod to dynamically implement methods.
When I call the dynamically implemented methods from other parts of the code, the compiler emits a warning that the object may not respond to the selector. I would like the compiler to not emit such warnings for this class, but I don’t want to suppress warnings when I invoke an invalid selector on other classes. Is this possible?
I have a class which uses resolveInstanceMethod to dynamically implement methods. When I call
Share
Assuming you know the method signatures that will be dynamically resolved at compile time, you can declare ’em in an informal category:
No need to provide an implementation.
If you don’t know the signatures — if the method names are dynamic, too — then you’ll need to use either
-performSelector:(or the single or double object argument variants) or you will likely want to use NSInvocation, unless performance is a major concern (if it is, there are alternative solutions that are significantly more fiddly).