Reputation: 15925
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
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
Reputation: 4085
NSString *sysVer = [[UIDevice currentDevice] systemVersion];
This should do the trick. Make sure to keep it as string.
Upvotes: 2