Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect iPhone OS version using macros

Tags:

iphone

I would like to detect iPhone OS version in my app. I have tried using detection code but was advised to use macros. Does someone experience, can you post sample code, and what library to use.

like image 750
sid Avatar asked Feb 25 '26 21:02

sid


1 Answers

I am not certain what macros you are being advised to use. I always thought that the standard way to find the version number so that it will be compatiable with future and previous versions was to use

NSString* versionNumber = [[UIDevice currentDevice] systemVersion]

which gives it as a NSString such as @"2.0" or @"2.2.1"

There are the Version constants that describe the version of Foundation classes being used, with NSFoundationVersionNumber but I am uncertain of how reliable this will be in older and future code.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!