程序中如何判断iOs的版本
来源:互联网 发布:网络协议分层口诀 编辑:程序博客网 时间:2024/05/07 02:51
问:
I want to check if the iOS version of the device is greater then the 3.1.3 I tried things like [[UIDevice currentDevice].systemVersion floatValue]
but does not work, I just want a if (version > 3.1.3) { }
Does anybody know how to do this?
Thanks
答:
You can get the OS version using:
[[UIDevice currentDevice] systemVersion]
However, you should avoid relying on the version string as an indication of device or OS capabilities. There is usually a more reliable method of checking whether a particular feature or class is available. For example, you can check if UIPopoverController
is available on the current device usingNSClassFromString
:
if(NSClassFromString(@"UIPopoverController")) { // Do something}
Some classes, like CLLocationManager
and UIDevice
, provide methods to check device capabilities:
if([CLLocationManager headingAvailable]) { // Do something}
Apple uses systemVersion
in their GLSprite sample code, so my recommendation can't be absolute:
// A system version of 3.1 or greater is required to use CADisplayLink. The NSTimer// class is used as fallback when it isn't available.NSString *reqSysVer = @"3.1";NSString *currSysVer = [[UIDevice currentDevice] systemVersion];if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending) displayLinkSupported = TRUE;
Important Note: If for whatever reason you decide that systemVersion
is what you want, make sure to treat it as an string or you risk truncating the minor revision number (eg. 3.1.2 -> 3.1).
- 程序中如何判断iOs的版本
- 如何在程序中判断VS的版本?
- 如何在程序中判断VS的版本?
- 如何判断IOS版本
- IOS 10 中版本的判断
- 如何在高版本的Xcode中部署低版本的ios程序
- js中如何判断IE的版本
- IOS中如何判断程序是否是第一次安装使用
- IOS中如何判断程序是否是第一次安装使用
- 如何判断一个类是否支持某属性和方法以及如何判断IOS的版本
- 如何判断一个类是否支持某属性和方法以及如何判断IOS的版本
- 如何判断一个类是否支持某属性和方法以及如何判断IOS的版本
- 如何判断一个类是否支持某属性和方法以及如何判断IOS的版本
- IOS学习之如何判断版本更新
- 在.Net安装项目中如何判断操作系统的版本
- 如何判断tp的版本
- 程序中判断Android系统版本
- IOS开发中如何区分IOS版本
- xml--struts2
- String从0开始 【不断更新】
- http_build_query可能遇到的问题 &=>【&】
- C++中的类所占内存空间总结
- 推荐Ubuntu的两个辅助软件:docky和guake
- 程序中如何判断iOs的版本
- 黑马程序员-Java反射机制
- 六分钟学会创建Oracle表空间的步骤
- RMAA对多个平台手机音质的评价
- C#加密方法汇总
- python正则表达式
- 图论基本知识点
- Qt for Android 配置详细
- flex+java通过RemoteObject方法交互的第二个Demo