How to check iOS version?

后端 未结 30 2986
一生所求
一生所求 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 06:57

    a bit late to the party but in light of iOS 8.0 out there this might be relevant:

    if you can avoid using

    [[UIDevice currentDevice] systemVersion]

    Instead check for existence of of a method/class/whatever else.

    if ([self.yourClassInstance respondsToSelector:@selector()]) 
    { 
        //do stuff 
    }
    

    I found it to be useful for location manager where I have to call requestWhenInUseAuthorization for iOS 8.0 but the method is not available for iOS < 8

提交回复
热议问题