Actually, I don’t think you need to do this, because when you build your project, you choose what kind of firmware it targets, as indicated in pgb. Then you can simply use the #ifdef directives. Here is more detailed information: iPhone firmware version for iPhone A more detailed answer is available here: How to target a specific iPhone version?
EDIT : I deleted some text after I realized that systemVersion is actually a string, source: Docs UIDevice .
If you will use it in different files in your project, you can organize it by adding it as a property to your appdelegate, and they will get the value by doing something like this:
MyAppDelegate *theDelegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate]; NSString *version = theDelegate.version;
But that might be too confusing for something as simple as the version number.
source share