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

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top