Question

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

Was it helpful?

Solution

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:].

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top