[ios] How to check iOS version?

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(<yourMethod>)]) 
{ 
    //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