To generate local notifications in my library, I need to use either UserNotification
or UILocalNotification
depending on what my host app uses. (Some customers are still using the deprecated didReceiveLocalNotification:
API).
Now when I create my notification, is it possible, at runtime, to determine which system the host app uses and create the appropriate APIs. This means I will need to conditionally import and use the UserNotification
header file.
EDIT:
Regarding the use of NSClassFromString
:
if (NSClassFromString(@"FrameworkClass") == nil) {
// the framework is not available
} else {
// the framework is avaiable
}
But I have a lot of UserNotification
code to write. I don't think using performSelector:
would be very practical.