खोज…


आईओएस 8 और बाद में

स्विफ्ट 3:

let minimumVersion = OperatingSystemVersion(majorVersion: 8, minorVersion: 1, patchVersion: 2)
if ProcessInfo().isOperatingSystemAtLeast(minimumVersion) {
    //current version is >= (8.1.2)
} else {
    //current version is < (8.1.2)
}

संस्करणों की तुलना करें

let minimumVersionString = "3.1.3"
let versionComparison = UIDevice.current.systemVersion.compare(minimumVersionString, options: .numeric)
switch versionComparison {
    case .orderedSame, .orderedDescending:
        //current version is >= (3.1.3)
        break
    case .orderedAscending:
        //current version is < (3.1.3)
        fallthrough
    default:
        break;
}

उद्देश्य सी

NSString *version = @"3.1.3"; 
NSString *currentVersion = @"3.1.1";
NSComparisonResult result = [currentVersion compare:version options:NSNumericSearch];
switch(result){
  case: NSOrderedAscending:
        //less than the current version
  break;
  case: NSOrderedDescending:
  case: NSOrderedSame:
       // equal or greater than the current version
  break;
}

स्विफ्ट 2.0 और बाद में

if #available(iOS 9, *) {
  // iOS 9
} else {
  // iOS 8 or earlier
}

डिवाइस आईओएस संस्करण

यह वर्तमान सिस्टम संस्करण देगा।

उद्देश्य सी

NSString *version = [[UIDevice currentDevice] systemVersion]

तीव्र

let version = UIDevice.currentDevice().systemVersion

स्विफ्ट 3

let version = UIDevice.current.systemVersion


Modified text is an extract of the original Stack Overflow Documentation
के तहत लाइसेंस प्राप्त है CC BY-SA 3.0
से संबद्ध नहीं है Stack Overflow