How to check iOS version?

后端 未结 30 2514
一生所求
一生所求 2020-11-21 06:37

I want to check if the iOS version of the device is greater than 3.1.3 I tried things like:

[[UIDevice currentDevice].systemVersion         


        
30条回答
  •  春和景丽
    2020-11-21 07:11

    Swift example that actually works:

    switch UIDevice.currentDevice().systemVersion.compare("8.0.0", options: NSStringCompareOptions.NumericSearch) {
    case .OrderedSame, .OrderedDescending:
        println("iOS >= 8.0")
    case .OrderedAscending:
        println("iOS < 8.0")
    }
    

    Don't use NSProcessInfo cause it doesn't work under 8.0, so its pretty much useless until 2016

提交回复
热议问题