美文网首页
iOS系统版本

iOS系统版本

作者: 悃破 | 来源:发表于2019-03-01 17:10 被阅读0次

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

    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系统版本

      本文链接:https://www.haomeiwen.com/subject/mqfjuqtx.html