Toad
Toad

Reputation: 15925

how can i test at runtime if i'm running on ios 5 or higher?

I want to use the IOS 5 username/password AlertView style in case I'm running on ios5, and show my own popup when I'm running on IOS4 and lower.

How can I at runtime detect the OS version?

Upvotes: 2

Views: 465

Answers (2)

Joshua Weinberg
Joshua Weinberg

Reputation: 28688

You generally don't want to check the OS version, but instead want to see if the specific selector you're looking for exists.

if ([fooAlertView respondsToSelector:@selector(alertViewStyle)])
    //Yay!

Upvotes: 6

mkral
mkral

Reputation: 4085

NSString *sysVer = [[UIDevice currentDevice] systemVersion];

This should do the trick. Make sure to keep it as string.

Upvotes: 2

Related Questions