Reputation: 1398
I'd like to use some classes introduced in iOS 5 in an app that also runs on iOS 4. I understand how to use respondsToSelector: to selectively invoke new methods on the newer OS versions. What is the equivalent to determine, at runtime, whether the class exists.
Upvotes: 1
Views: 109
Reputation: 15376
if (NSClassFromString(@"ClassName") != nil)
{
// use class
}
else
{
// not available, deal with it.
}
Upvotes: 5