Forwarding, Distributed Objects, and Proxies

When objc_msgSend(id self, SEL op, ...) and objc_msgSendSuper(struct objc_super *super, SEL op, ...) fail to find a method that corresponds to the selector of a received message, the –forwardInvocation: method implemented by the NSObject class is called. The argument to –forwardInvocation: is an instance of the NSInvocation class initialized with information about the message that could not be handled including the selector and any arguments.

The default implementation of –forwardInvocation: calls [self doesNotRecognizeSelector:aSelector]. The –doesNotRecognizeSelector: method raises an exception. If –forwardInvocation: is overloaded, it can be implemented to find another receiver for the message ...

Get Cocoa® Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.