简体   繁体   中英

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?

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!
NSString *sysVer = [[UIDevice currentDevice] systemVersion];

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM