- How to check that a class has a method before calling it
- if([targetObject respondsToSelector:@selector(myOptionalMethod)]) {
- [targetObject myOptionalMethod];
- }
- if ([[UIApplication sharedApplication] respondsToSelector:@selector(beginBackgroundTaskWithExpirationHandler:)]) {