如何查找iOS版本
答
尝试UIDevice.CurrentDevice.SystemVersion
。
答
在MonoTouch的:
要得到主要版本使用:
UIDevice.CurrentDevice.SystemVersion.Split('.')[0]
对于次要版本使用:
UIDevice.CurrentDevice.SystemVersion.Split('.')[1]
答
如果你只需要一个布尔条件,有便利方法:
if (UIDevice.CurrentDevice.CheckSystemVersion (6, 0)) // at least 6.0
+0
如果我没有错,上面可以检查版本像6.0,6.1,但不是“9.3.1”和“9.3.2”。 – 2016-06-28 10:06:37
答
有一个.net System.Version类可以从字符串转换。
var str = "3.5.3858.2";
Version version = Version.TryParse(str,out version) ? version : null;
if(version != null)
{
// version.Major
// version.Minor
// version.Build
}
正是我在找的,谢谢! – riha 2011-05-23 13:05:21
大小数字如何? – Kenny 2012-07-17 15:36:57
@Kenny在这里看到:goo.gl/PzUEu – somedev 2012-07-17 16:04:07