Message Forwarding Chain

I have read Apple's message forwarding document and other articles, and it seems that the ObjC runtime will redirect unrecognized messages for the object automatically, and if there is no corresponding selector, it will throw an "unrecognized selector sent to instance" error.

But I have two questions that I cannot explain.

  • How does the runtime find the next message forwarding object?
  • Can anyone explain the objc messaging chain?
+3
source share
2 answers

and it seems that the ObjC runtime will redirect unrecognized messages for the object automatically

. "" , forwardInvocation:. , , , .

- ObjC?

, . . Cocoa Cocoa , (NSResponder UIResponder ), "" , " ". , , . , Cocoa , - . , , - ( ).

+4

obj. , obj, SDK

methodSignatureForSelector:

( , NSObject methodSignatureForSelector:

). NSMethodSignature, obj , SDK, .

0

All Articles