获取NSInvocation的消息发件人 [英] Get the sender of the message for an NSInvocation
问题描述
我如何获取包裹在NSInvocation中的消息的发件人?
How do I get the sender of the message wrapped in an `NSInvocation?
我在一个对象中,而我刚刚收到了一个调用 forwardInvocation:
。
是否有办法知道谁是第一位向我发送消息的人?
I'm in an object, and I've just received an invocation in my forwardInvocation:
.
Is there any way to know who sent me the message in the first place?
推荐答案
否。有关发件人的信息不可用(除非您显式添加 sender:self
自变量)。
No. Information about the sender is not available (unless you explicitly add an sender:self
argument).
它不是显式可用的,也不能始终释放
堆栈来弄清楚。甚至也不能保证
发送者确实是一些Objective-C对象。在各种
语言桥的情况下,
可能很容易成为函数或FFI产生的闭包。
It isn't explicitly available, nor can you consistently unwind the stack to figure it out. Nor is there even a guarantee that the "sender" is really some Objective-C object; it could just as easily be a function or FFI produced closure, in the case of the various language bridges.
b.bum
这篇关于获取NSInvocation的消息发件人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!