0

Is it possible to get id pointer to object which was called selector inside function with no sender argument?

- (void)didSomeThing {//delegate method may call from any object
//how to get sender = someObj?
id sender = ??
} 
....
//calling
[someObj didSomeThing];
...
rmaddy
  • 307,833
  • 40
  • 508
  • 550
AleyRobotics
  • 960
  • 1
  • 10
  • 16

1 Answers1

2

You can't find out who is sender.

Every time you send message to object compiler transform it to:

objc_msgSend(receiver, selector, arg1, arg2, ...)

As you can see here is no way you can find out who is calling method except passing sender as parameter.

You can read more about it here in documentation

Konstantin
  • 861
  • 4
  • 12