2

I've seen various methods of checking the iOS version of the device.

From some example in Apple Documentation :

if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
    // < = 6.1
} else {
    // > = 7
}

And from many examples over SO / Internet :

[[UIDevice currentDevice] systemVersion]

What is the difference between NSFoundationVersionNumber and [[UIDevice currentDevice] systemVersion] ?

And which one should we use ?

Preetam Jadakar
  • 4,479
  • 2
  • 28
  • 58
Nikhil Patel
  • 1,761
  • 12
  • 23

1 Answers1

3

They basically provide the same answer, however, NSFoundationVersionNumber is better, as no string parsing of the systemVersion is needed.

Albara
  • 1,306
  • 8
  • 14
  • My SDKs only include `NSFoundationVersionNumber` and `NAAppKitVersionNumber` only to iOS 7.1 and Mac OS 10.9.2. I navigated to the 8.1 resp. 10.10 SDK --> Frameworks --> Foundation --> NSObjcRuntime.h – Julian F. Weinert Jan 20 '15 at 13:03