Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I check if a device is running iOS 6? [duplicate]

Possible Duplicate:
How can we programmatically detect which iOS version is device running on?

How do I check if a device is running iOS 6? I need to check to see if the os is iOS 6 in order to change my youtube video urls because of the release notes from Apple on how to handle them in iOS6

As of iOS 6, embedded YouTube URLs in the form of http://www.youtube.com/watch?v=oHg5SJYRHA0 will no longer work. These URLs are for viewing the video on the YouTube site, not for embedding in web pages. Instead, the format that should be used is described in https://developers.google.com/youtube/player_parameters.

I was thinking of an if else statement to handle this.

thanks for any help

like image 729
hanumanDev Avatar asked Oct 12 '12 10:10

hanumanDev


2 Answers

As Before comparing float parameters you should put 6.0 in a float variable so that LHS and RHS should be the same to compare:

float currentVersion = 6.0;

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= currentVersion)
{
    NSLog(@"Running in IOS-6");
}
like image 164
Bhupendra Avatar answered Oct 16 '22 17:10

Bhupendra


NSString *versionString = [[UIDevice currentDevice] systemVersion]; // iOS version as string
int versionStringInt = [ver intValue]; // iOS version as int
float versionStringFloat = [ver floatValue]; // iOS version as float
like image 22
Shamsudheen TK Avatar answered Oct 16 '22 17:10

Shamsudheen TK