0

Possible Duplicate:
Check iPhone iOS Version

I am trying to setup some code that is different on iOS 5.0.1 than it is one iOS 5.1 and higher. Is there an if statement to determine it or not?

Community
  • 1
  • 1
user717452
  • 33
  • 14
  • 73
  • 149

2 Answers2

0
float version = [[[UIDevice currentDevice] systemVersion] floatValue];
shabbirv
  • 8,958
  • 4
  • 33
  • 34
0
   if ( [[[UIDevice currentDevice] systemVersion] floatValue] == 5.0)
{
// Do something
}


else if ( [[[UIDevice currentDevice] systemVersion] floatValue] == 5.1)
{
// Do something
}
else
{
// Do something
}
iArezki
  • 1,273
  • 2
  • 17
  • 29
  • This is wrong for reasons outlined in comments to http://stackoverflow.com/a/3341214/118721 (see the accepted answer there for a correct solution). – yakovlev Aug 22 '12 at 21:15