tags:

views:

288

answers:

1

I would like to detect iPhone OS version in the app, can you post sample code as well. I tried using macro that didn't help.

Thanks in advance

+4  A: 

You need to use the macros if you want conditional compilation:

 #ifdef __IPHONE_3_0
 // Works on >= version 3.0
 #else
 // Works on < version 3.0
 #end

Or alternatively, to check at runtime, use:

float ver = [[[UIDevice currentDevice] systemVersion] floatValue];
if (ver >= 3.0) {
    // Only executes on version 3 or above.
}
John Feminella