-1

Referring to the discussion performSelector where is explained that with the following line it is possible to call a method

SEL aSelector = findTheAppropriateSelectorForTheCurrentSituation();
[anObject performSelector: aSelector];

My question is what is the content of the method called:
findTheAppropriateSelectorForTheCurrentSituation()? //For me the most important question

And another question is, why I get the warnings when using this piece of code.

1.warning: implicit declaration of function 'findTheAppropriateSelectorForTheCurrentSituation'
2.warning: initialization makes pointer from integer without a cast
3."_findTheAppropriateSelectorForTheCurrentSituation", referenced from:

Thank you for your answeres in advance

Community
  • 1
  • 1
Studie
  • 799
  • 2
  • 12
  • 20

1 Answers1

0

You'd have to look up the documentation or disassemble the binary that contains that method in order to determine exactly what it does. As for your warning, your syntax is incorrect. You should use the @selector(name) syntax in order to create a selector you can use to call [obj performSelector:].

PfhorSlayer
  • 1,337
  • 9
  • 14
  • You've edited your post after I posted my answer, but the function you're calling would do whatever it needs to do to return the correct selector. You're basically asking "what does the function DoStuff() do?", and no one can answer that but you! – PfhorSlayer Nov 15 '11 at 10:39
  • 1
    thank you, but how to disassemble the binary? I checked up the apple documentation. And there is no explicit definition of the content. – Studie Nov 15 '11 at 10:45
  • It is not a real function. It is an example, and it should do exactly what it says - find the appropriate selector for whatever the current situation happens to be. – PfhorSlayer Nov 15 '11 at 10:50