[self playButtonSound]
Here, the compiler checks to see if your object responds to the -playButtonSound message and will give you a warning if this is not the case.
[self performSelector:@selector(playButtonSound)]
Calling -playButtonSound this way you will not get a compiler warning. However, you can dynamically check whether objects respond to a specific selector, so you can safely try to call an arbitrary selector of an object without specifying its type and not receive warnings about the compiler (which can be useful, for example, for calling additional methods in object deletes)
if ([self respondsToSelector:@selector(playButtonSound)]) [self performSelector:@selector(playButtonSound)];
Vladimir Apr 20 2018-10-12T00: 00Z
source share