Thursday, 4 July 2013

Check for device iOS version. is device is iOS 5 or iOS 6.

+ (BOOL) isIOS5
{
    NSString *os5 = @"5.0";
    NSString *currSysVer = [[UIDevice currentDevicesystemVersion];
    
    //    currSysVer = @"5.0.1";
    if ([currSysVer compare:os5 options:NSNumericSearch] == NSOrderedAscending//lower than 4
    {
        return NO;
    }
    else if ([currSysVer compare:os5 options:NSNumericSearch] == NSOrderedDescending//5.0.1 and above
    {
        return YES;
    }
    else // IOS 5
    {
        return YES;
    }
    
    return NO;
}



+ (BOOL) isIOS6
{
    NSString *os6 = @"6.0";
    NSString *currSysVer = [[UIDevice currentDevicesystemVersion];
    
    //    currSysVer = @"6.0.1";
    if ([currSysVer compare:os6 options:NSNumericSearch] == NSOrderedAscending)
    {
        return NO;
    }
    else if ([currSysVer compare:os6 options:NSNumericSearch] == NSOrderedDescending)
    {
        return YES;
    }
    else // IOS 5
    {
        return YES;
    }
    
    return NO;
}

No comments:

Post a Comment