iOS 各个机型具体判断

structutsnamesystemInfo;

    uname(&systemInfo);

    NSString*platform = [NSStringstringWithCString:systemInfo.machine

                                                encoding:NSUTF8StringEncoding];

    //simulator

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

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


    //AirPods

    if([platformisEqualToString:@"AirPods1,1"])    return@"AirPods";


    //Apple TV

    if ([platform isEqualToString:@"AppleTV2,1"])    return @"Apple TV (2nd generation)";

    if ([platform isEqualToString:@"AppleTV3,1"])    return @"Apple TV (3rd generation)";

    if ([platform isEqualToString:@"AppleTV3,2"])    return @"Apple TV (3rd generation)";

    if ([platform isEqualToString:@"AppleTV5,3"])    return @"Apple TV (4th generation)";

    if ([platform isEqualToString:@"AppleTV6,2"])    return @"Apple TV 4K";


    //Apple Watch

    if ([platform isEqualToString:@"Watch1,1"])    return @"Apple Watch (1st generation)";

    if ([platform isEqualToString:@"Watch1,2"])    return @"Apple Watch (1st generation)";

    if ([platform isEqualToString:@"Watch2,6"])    return @"Apple Watch Series 1";

    if ([platform isEqualToString:@"Watch2,7"])    return @"Apple Watch Series 1";

    if ([platform isEqualToString:@"Watch2,3"])    return @"Apple Watch Series 2";

    if ([platform isEqualToString:@"Watch2,4"])    return @"Apple Watch Series 2";

    if ([platform isEqualToString:@"Watch3,1"])    return @"Apple Watch Series 3";

    if ([platform isEqualToString:@"Watch3,2"])    return @"Apple Watch Series 3";

    if ([platform isEqualToString:@"Watch3,3"])    return @"Apple Watch Series 3";

    if ([platform isEqualToString:@"Watch3,4"])    return @"Apple Watch Series 3";


    //HomePod

    if ([platform isEqualToString:@"AudioAccessory1,1"])    return @"HomePod";


    //iPad

    if([platformisEqualToString:@"iPad1,1"])    return@"iPad";

    if([platformisEqualToString:@"iPad2,1"])    return@"iPad 2";

    if([platformisEqualToString:@"iPad2,2"])    return@"iPad 2";

    if([platformisEqualToString:@"iPad2,3"])    return@"iPad 2";

    if([platformisEqualToString:@"iPad2,4"])    return@"iPad 2";

    if ([platform isEqualToString:@"iPad3,1"])    return @"iPad (3rd generation)";

    if ([platform isEqualToString:@"iPad3,2"])    return @"iPad (3rd generation)";

    if ([platform isEqualToString:@"iPad3,3"])    return @"iPad (3rd generation)";

    if ([platform isEqualToString:@"iPad3,4"])    return @"iPad (4th generation)";

    if ([platform isEqualToString:@"iPad3,5"])    return @"iPad (4th generation)";

    if ([platform isEqualToString:@"iPad3,6"])    return @"iPad (4th generation)";

    if([platformisEqualToString:@"iPad4,1"])    return@"iPad Air";

    if([platformisEqualToString:@"iPad4,2"])    return@"iPad Air";

    if([platformisEqualToString:@"iPad4,3"])    return@"iPad Air";

    if([platformisEqualToString:@"iPad5,3"])    return@"iPad Air 2";

    if([platformisEqualToString:@"iPad5,4"])    return@"iPad Air 2";

    if ([platform isEqualToString:@"iPad11,3"])    return @"iPad Air (3rd generation)";

    if ([platform isEqualToString:@"iPad11,4"])    return @"iPad Air (3rd generation)";

    if ([platform isEqualToString:@"iPad13,1"])    return @"iPad Air (4th generation)";

    if ([platform isEqualToString:@"iPad13,2"])    return @"iPad Air (4th generation)";

    if ([platform isEqualToString:@"iPad6,7"])    return @"iPad Pro (12.9-inch)";

    if ([platform isEqualToString:@"iPad6,8"])    return @"iPad Pro (12.9-inch)";

    if ([platform isEqualToString:@"iPad6,3"])    return @"iPad Pro (9.7-inch)";

    if ([platform isEqualToString:@"iPad6,4"])    return @"iPad Pro (9.7-inch)";

    if ([platform isEqualToString:@"iPad6,11"])    return @"iPad (5th generation)";

    if ([platform isEqualToString:@"iPad6,12"])    return @"iPad (5th generation)";

    if ([platform isEqualToString:@"iPad7,1"])    return @"iPad Pro (12.9-inch, 2nd generation)";

    if ([platform isEqualToString:@"iPad7,2"])    return @"iPad Pro (12.9-inch, 2nd generation)";

    if ([platform isEqualToString:@"iPad7,3"])    return @"iPad Pro (10.5-inch)";

    if ([platform isEqualToString:@"iPad7,4"])    return @"iPad Pro (10.5-inch)";

    if ([platform isEqualToString:@"iPad8,1"])    return @"iPad Pro (11-inch)";

    if ([platform isEqualToString:@"iPad8,2"])    return @"iPad Pro (11-inch)";

    if ([platform isEqualToString:@"iPad8,3"])    return @"iPad Pro (11-inch)";

    if ([platform isEqualToString:@"iPad8,4"])    return @"iPad Pro (11-inch)";

    if ([platform isEqualToString:@"iPad8,5"])    return @"iPad Pro (12.9-inch) (3rd generation)";

    if ([platform isEqualToString:@"iPad8,6"])    return @"iPad Pro (12.9-inch) (3rd generation)";

    if ([platform isEqualToString:@"iPad8,7"])    return @"iPad Pro (12.9-inch) (3rd generation)";

    if ([platform isEqualToString:@"iPad8,8"])    return @"iPad Pro (12.9-inch) (3rd generation)";

    if ([platform isEqualToString:@"iPad8,9"])    return @"iPad Pro (11-inch) (2nd generation)";

    if ([platform isEqualToString:@"iPad8,10"])    return @"iPad Pro (11-inch) (2nd generation)";

    if ([platform isEqualToString:@"iPad8,11"])    return @"iPad Pro (12.9-inch) (4th generation)";

    if ([platform isEqualToString:@"iPad8,12"])    return @"iPad Pro (12.9-inch) (4th generation)";


    if ([platform isEqualToString:@"iPad7,5"])    return @"iPad (6th generation)";

    if ([platform isEqualToString:@"iPad7,6"])    return @"iPad (6th generation)";

    if ([platform isEqualToString:@"iPad7,11"])    return @"iPad (7th generation)";

    if ([platform isEqualToString:@"iPad7,12"])    return @"iPad (7th generation)";

    if ([platform isEqualToString:@"iPad11,6"])    return @"iPad (8th generation)";

    if ([platform isEqualToString:@"iPad11,7"])    return @"iPad (8th generation)";


    //iPad mini

    if([platformisEqualToString:@"iPad2,5"])    return@"iPad mini";

    if([platformisEqualToString:@"iPad2,6"])    return@"iPad mini";

    if([platformisEqualToString:@"iPad2,7"])    return@"iPad mini";

    if([platformisEqualToString:@"iPad4,4"])    return@"iPad mini 2";

    if([platformisEqualToString:@"iPad4,5"])    return@"iPad mini 2";

    if([platformisEqualToString:@"iPad4,6"])    return@"iPad mini 2";

    if([platformisEqualToString:@"iPad4,7"])    return@"iPad mini 3";

    if([platformisEqualToString:@"iPad4,8"])    return@"iPad mini 3";

    if([platformisEqualToString:@"iPad4,9"])    return@"iPad mini 3";

    if([platformisEqualToString:@"iPad5,1"])    return@"iPad mini 4";

    if([platformisEqualToString:@"iPad5,2"])    return@"iPad mini 4";

    if ([platform isEqualToString:@"iPad11,1"])    return @"iPad mini (5th generation)";

    if ([platform isEqualToString:@"iPad11,2"])    return @"iPad mini (5th generation)";


    //iPhone

    if([platformisEqualToString:@"iPhone1,1"])    return@"iPhone 1G";

    if([platformisEqualToString:@"iPhone1,2"])    return@"iPhone 3G";

    if([platformisEqualToString:@"iPhone2,1"])    return@"iPhone 3GS";

    if([platformisEqualToString:@"iPhone3,1"])    return@"iPhone 4";

    if([platformisEqualToString:@"iPhone3,2"])    return@"iPhone 4";

    if([platformisEqualToString:@"iPhone4,1"])    return@"iPhone 4S";

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

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

    if([platformisEqualToString:@"iPhone5,3"])    return@"iPhone 5C";

    if([platformisEqualToString:@"iPhone5,4"])    return@"iPhone 5C";

    if([platformisEqualToString:@"iPhone6,1"])    return@"iPhone 5S";

    if([platformisEqualToString:@"iPhone6,2"])    return@"iPhone 5S";

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if([platformisEqualToString:@"iPhone12,1"])    return@"iPhone 11";

    if ([platform isEqualToString:@"iPhone12,3"])    return @"iPhone 11 Pro";

    if ([platform isEqualToString:@"iPhone12,5"])    return @"iPhone 11 Pro Max";

    if ([platform isEqualToString:@"iPhone12,8"])    return @"iPhone SE (2nd generation)";

    if ([platform isEqualToString:@"iPhone13,1"])    return @"iPhone 12 mini";

    if([platformisEqualToString:@"iPhone13,2"])    return@"iPhone 12";

    if ([platform isEqualToString:@"iPhone13,3"])    return @"iPhone 12 Pro";

    if ([platform isEqualToString:@"iPhone13,4"])    return @"iPhone 12 Pro Max";

    if ([platform isEqualToString:@"iPhone14,4"])    return @"iPhone 13 mini";

    if([platformisEqualToString:@"iPhone14,5"])    return@"iPhone 13";

    if ([platform isEqualToString:@"iPhone14,2"])    return @"iPhone 13 Pro";

    if ([platform isEqualToString:@"iPhone14,3"])    return @"iPhone 13 Pro Max";


    //iPod touch

    if([platformisEqualToString:@"iPod1,1"])    return@"iPod touch";

    if ([platform isEqualToString:@"iPod2,1"])    return @"iPod touch (2nd generation)";

    if ([platform isEqualToString:@"iPod3,1"])    return @"iPod touch (3rd generation)";

    if ([platform isEqualToString:@"iPod4,1"])    return @"iPod touch (4th generation)";

    if ([platform isEqualToString:@"iPod5,1"])    return @"iPod touch (5th generation)";

    if ([platform isEqualToString:@"iPod7,1"])    return @"iPod touch (6th generation)";

    if ([platform isEqualToString:@"iPod9,1"])    return @"iPod touch (7th generation)";

你可能感兴趣的:(iOS 各个机型具体判断)