iOS系统版本

获取系统版本号、系统代号等相关信息。

    NSProcessInfo *info = [NSProcessInfo processInfo];
    NSString *build = info.operatingSystemVersionString;
    NSLog(@"build:%@", build); //build:Version 12.1.4 (Build 16D57)
    NSOperatingSystemVersion version = info.operatingSystemVersion;
    NSInteger majorVersion = version.majorVersion;
    NSInteger minorVersion = version.minorVersion;
    NSInteger patchVersion = version.patchVersion;
    NSLog(@"major: %ld \nminor: %ld, \npatch: %ld",majorVersion, minorVersion, patchVersion);
    /*
     major: 12
     minor: 1,
     patch: 4
     */
    NSString *systemVersion = [UIDevice currentDevice].systemVersion;
    NSLog(@"systemVersion: %@", systemVersion); //systemVersion: 12.1.4

你可能感兴趣的:(iOS系统版本)