objective-cobjective-c-runtimensinvocationmessage-forwarding

Swallow doesnotrecognizeselector exception from an NSInvocation forwardInvocation call


I have an object which is forwarding receiving messages. It does not implement forwarding them to other objects using forwardInvocation. However, methodSignatureForSelector will not always return a valid method signature at certain times because of the way the program is organized. How can I swallow the exception generated from the missing method signature? Overriding doesNotRecognizeSelector does not work. Thanks.


Solution

  • You must generate some signature (even if a dummy one, e.g. v@:, a signature of a method that returns void and takes no arguments) and then remember to do nothing when it gets to forwardInvocation:.