What object called a method in Obj-C
Posted
by Loz
on Stack Overflow
See other posts from Stack Overflow
or by Loz
Published on 2010-04-16T19:58:41Z
Indexed on
2010/04/16
20:03 UTC
Read the original article
Hit count: 200
Hi,
I am looking to write a plugin controller in Cocoa that loads bundles, and exposes a specific set of methods for the plugins to call.
My question is this: is it possible to know (any) info about the object that called a method in the controller. When an instantiated plugin calls a method in my plugin controller, I would like to know which of the plugin instances called the method, without having to rely on the plugin sending a pointer to itself as a parameter (I could always validate the pointer they send, but I want to keep the API methods as simple as possible).
There may be no perfect solution (and there are simple workarounds), but it's always good to learn some new tricks if possible (or the reasons why it's impossible).
Thanks in advance.
© Stack Overflow or respective owner