美文网首页
(IOS)获取手机型号

(IOS)获取手机型号

作者: rightmost | 来源:发表于2018-12-26 17:12 被阅读0次

    + (NSString*)deviceVersion

    {

        structutsnamesystemInfo;

        uname(&systemInfo);

        NSString *platform = [NSString stringWithCString:systemInfo.machine encoding:NSASCIIStringEncoding];

        if ([platform isEqualToString:@"iPhone5,1"]) return @"iPhone 5";

        if ([platform isEqualToString:@"iPhone5,2"]) return @"iPhone 5";

        if ([platform isEqualToString:@"iPhone5,3"]) return @"iPhone 5c";

        if ([platform isEqualToString:@"iPhone5,4"]) return @"iPhone 5c";

        if ([platform isEqualToString:@"iPhone6,1"]) return @"iPhone 5s";

        if ([platform isEqualToString:@"iPhone6,2"]) return @"iPhone 5s";

        if ([platform isEqualToString:@"iPhone7,1"]) return @"iPhone 6 Plus";

        if ([platform isEqualToString:@"iPhone7,2"]) return @"iPhone 6";

        if ([platform isEqualToString:@"iPhone8,1"]) return @"iPhone 6s";

        if ([platform isEqualToString:@"iPhone8,2"]) return @"iPhone 6s Plus";

        if ([platform isEqualToString:@"iPhone8,4"]) return @"iPhone SE";

        if ([platform isEqualToString:@"iPhone9,1"]) return @"iPhone 7";

        if ([platform isEqualToString:@"iPhone9,3"]) return @"iPhone 7";

        if ([platform isEqualToString:@"iPhone9,2"]) return @"iPhone 7 Plus";

        if ([platform isEqualToString:@"iPhone9,4"]) return @"iPhone 7 Plus";

        if ([platform isEqualToString:@"iPhone10,1"]) return @"iPhone 8";

        if ([platform isEqualToString:@"iPhone10,4"]) return @"iPhone 8";

        if ([platform isEqualToString:@"iPhone10,2"]) return @"iPhone 8 Plus";

        if ([platform isEqualToString:@"iPhone10,5"]) return @"iPhone 8 Plus";

        if ([platform isEqualToString:@"iPhone10,3"]) return @"iPhone X";

        if ([platform isEqualToString:@"iPhone10,6"]) return @"iPhone X";

        if ([platform isEqualToString:@"iPhone11,8"]) return @"iPhone XR";

        if ([platform isEqualToString:@"iPhone11,2"]) return @"iPhone XS";

        if ([platform isEqualToString:@"iPhone11,6"]) return @"iPhone XS Max";

        if ([platform isEqualToString:@"iPhone11,4"]) return @"iPhone XS Max";

        if([platformisEqualToString:@"i386"])      return@"iPhone Simulator";

        if ([platform isEqualToString:@"x86_64"])    return @"iPhone Simulator";

        returnplatform;

    }

    相关文章

      网友评论

          本文标题:(IOS)获取手机型号

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