I have a Cocoa app which has different features in Mac OS 10.7 and 10.8 (The deployment target is 10.7). For example, in 10.8 I have a button for Sharing Service
while in 10.7 the button is hidden.
The problem here is how can I know which kind of Mac OS is there while my app is running. For iOS, I can get it from UIDevice
. But for Cocoa, I don't find the similar class.
Currently, I detect the OS using:
- (BOO)isServiceAvalable
{
if (NSClassFromString(@"A_Unique_Class_In_One_OS"))
{
return YES;
}
return NO;
}
I hope there is more elegant way to do it.