1

Is there any way I can find out in my app if the user is running it on a device with OS 2.x or 3.0?

I tried adding a tag like the iPhone project templates do, but it doesn't seem to work.

#ifndef __IPHONE_3_0
//MY CODE FOR 3.0 GOES HERE
#else
//2.x CODE HERE
#endif

Thanks.

lostInTransit
  • 70,519
  • 61
  • 198
  • 274

3 Answers3

3

Check out [[UIDevice currentDevice] systemVersion]. This will contain the version string.

diederikh
  • 25,221
  • 5
  • 36
  • 49
2
#ifndef __IPHONE_3_0
#define __IPHONE_3_0 30000
#endif
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_3_0
    [[startButton titleLabel] setFont:playFont];
#else
    [startButton setFont:playFont];
#endif
Saurabh
  • 22,743
  • 12
  • 84
  • 133
1

Depending on what you are trying to do, it is better to test for functionality rather than a specific version.

g .
  • 8,110
  • 5
  • 38
  • 48