user371320
user371320

Reputation: 1398

iOS5 classes on iOS4

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

Answers (1)

hypercrypt
hypercrypt

Reputation: 15376

if (NSClassFromString(@"ClassName") != nil)
{
    // use class
}
else
{
    // not available, deal with it.
}

Upvotes: 5

Related Questions