NSObject 的消息转发机制

截屏2020-12-16 上午11.49.46.png

Step1

/// Dynamically provides an implementation for a given selector for a class method.

  • (BOOL)resolveClassMethod:(SEL)sel OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0);

/// Dynamically provides an implementation for a given selector for an instance method

  • (BOOL)resolveInstanceMethod:(SEL)sel OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0);

Step2

/// Returns the object to which unrecognized messages should first be directed.

  • (id)forwardingTargetForSelector:(SEL)aSelector OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0);

Step3

/// Overridden by subclasses to forward messages to other objects.

  • (void)forwardInvocation:(NSInvocation *)anInvocation OBJC_SWIFT_UNAVAILABLE("");

/// Returns an NSMethodSignature object that contains a description of the method identified by a given selector.

  • (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector OBJC_SWIFT_UNAVAILABLE("");

你可能感兴趣的:(NSObject 的消息转发机制)