如何找到iOS版本

如何找到iOS版本,ios,xamarin.ios,version,Ios,Xamarin.ios,Version,是否可以读取运行MonoTouch应用程序的iOS版本(4.2.1、4.3.3等)?如果是,如何操作?在MonoTouch中尝试UIDevice.CurrentDevice.SystemVersion: 要获取主要版本,请使用: UIDevice.CurrentDevice.SystemVersion.Split('.')[0] UIDevice.CurrentDevice.SystemVersion.Split('.')[1] 对于次要版本使用: UIDevice.CurrentDevic

是否可以读取运行MonoTouch应用程序的iOS版本(4.2.1、4.3.3等)?如果是,如何操作?

在MonoTouch中尝试
UIDevice.CurrentDevice.SystemVersion

要获取主要版本,请使用:

UIDevice.CurrentDevice.SystemVersion.Split('.')[0]
UIDevice.CurrentDevice.SystemVersion.Split('.')[1]
对于次要版本使用:

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

如果您只需要将其用于布尔条件,则有一种方便的方法:

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

有一个.net System.Version类要从字符串转换

var str=“3.5.3858.2”;
Version Version=Version.TryParse(str,out版本)?版本:空;
如果(版本!=null)
{
//版本,少校
//版本。小调
//版本
} 

大数字和小数字如何?@Kenny请看这里:goo.gl/PzUEuYou可以使用`新版本(UIDevice.CurrentDevice.SystemVersion)`来获取System.VersionOr的实例,如果您需要布尔条件,则更简单。如果我没有错,上述版本可以检查6.0、6.1等版本,但不能检查“9.3.1”和“9.3.2”。