开发者

How to find out iOS version

开发者 https://www.devze.com 2023-03-07 14:24 出处:网络
Is it possib开发者_运维百科le to read the iOS version (4.2.1, 4.3.3, etc.) running a MonoTouch app? If so, how?Try UIDevice.CurrentDevice.SystemVersion.If you only need it for a boolean condition, the

Is it possib开发者_运维百科le to read the iOS version (4.2.1, 4.3.3, etc.) running a MonoTouch app? If so, how?


Try UIDevice.CurrentDevice.SystemVersion.


If you only need it for a boolean condition, there is a convenience method:

if (UIDevice.CurrentDevice.CheckSystemVersion (6, 0)) // at least 6.0


In MonoTouch:

To get the Major version use:

UIDevice.CurrentDevice.SystemVersion.Split('.')[0]

For minor version use:

UIDevice.CurrentDevice.SystemVersion.Split('.')[1]


There is a .net System.Version class to convert from string.

var str = "3.5.3858.2";
Version version = Version.TryParse(str,out version) ? version : null;
if(version != null)
{
    // version.Major
    // version.Minor
    // version.Build
} 
0

精彩评论

暂无评论...
验证码 换一张
取 消