https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtHowMessagingWorks.html#//apple_ref/doc/uid/TP40008048-CH104-SW2 he objc_msgSend Function In Objective-C, messages aren’t bound to method implemen…
在Effective Objective-C 2.0 – 52 Specific Ways to Improve Your iOS and OS X Programs一书中,tip 11主要讲述了Objective-C中的消息传递机制.这也是Objective-C在C的基础上,做的最基础也是最重要的封装. Static Binding And Dynamic Binding C中的函数调用方式,是使用的静态绑定(static binding),即在编译期就能决定运行时所应调用的函数.而在Obje…
[NSNull null]是一个对象,其类为NSNULL(isa):里面没有任何变量.函数.和实现. nil的处理展示出消息机制的优越性,相对于函数调用的空指针处理. ENTRY objc_msgSend # check whether receiver is nil teq a1, #0 itt eq moveq a2, #0 bxeq lr # save registers and load receiver's class for CacheLookup stmfd …