Skip to content

Instantly share code, notes, and snippets.

@seiji
Last active October 2, 2015 01:28
Show Gist options
  • Save seiji/2145615 to your computer and use it in GitHub Desktop.
Save seiji/2145615 to your computer and use it in GitHub Desktop.
iPhonePlatformString
// ARMv6:
// iPhone (v1.0.0 ~ v3.1.3)
// iPhone 3G (v2.0.0 ~ v4.2.1)
// iPod Touch (v1.1.0 ~ v3.1.3)
// iPod Touch (2nd) (v2.1.2 ~ v4.2.1)
// ARMv7:
// iPhone 3GS (v3.0.0 ~ )
// iPhone 4 (GSM) (v4.0.0 ~ ) *
// iPhone 4 (CDMA) (v4.2.5 ~ ) *
// iPhone 4S (v5.0.0 ~ ) *
// iPod Touch (3rd) (v3.1.0 ~ v5.1.1)
// iPod Touch (4th) (v4.1.0 ~ ) *
// iPod Touch (5th) (v6.0.0 ~ ) *
// iPad (v3.2.0 ~ v5.1.1)
// iPad2 (v4.3.0 ~ )
// iPad (3rd) (v5.1.0 ~ ) *
// iPad mini (v6.0.0 ~ )
// ARMv7s
// iPhone 5 (v6.0.0 ~ ) *
// iPad (4th) (v6.0.0 ~ ) *
//
- (NSString *) platformString:(NSString *platform) {
// iPhone
if ([platform isEqualToString:@"iPhone1,1"]) return @"iPhone 1G";
if ([platform isEqualToString:@"iPhone1,2"]) return @"iPhone 3G";
if ([platform hasPrefix:@"iPhone2"]) return @"iPhone 3GS";
if ([platform hasPrefix:@"iPhone3"]) return @"iPhone 4";
if ([platform hasPrefix:@"iPhone4"]) return @"iPhone 4S";
if ([platform hasPrefix:@"iPhone5"]) return @"iPhone 5";
// iPod
if ([platform hasPrefix:@"iPod1"]) return @"iPod Touch 1G";
if ([platform hasPrefix:@"iPod2"]) return @"iPod Touch 2G";
if ([platform hasPrefix:@"iPod3"]) return @"iPod Touch 3G";
if ([platform hasPrefix:@"iPod4"]) return @"iPod Touch 4G";
if ([platform hasPrefix:@"iPod5"]) return @"iPod Touch 5G";
// iPad
if ([platform hasPrefix:@"iPad1"]) return @"iPad";
if ([platform isEqualToString:@"iPad2,1"]) return @"iPad 2 (WiFi)";
if ([platform isEqualToString:@"iPad2,2"]) return @"iPad 2 (GSM)";
if ([platform isEqualToString:@"iPad2,3"]) return @"iPad 2 (CDMA)";
if ([platform isEqualToString:@"iPad2,4"]) return @"iPad 2 (WiFi)";
if ([platform isEqualToString:@"iPad2,5"]) return @"iPad mini (WiFi)";
if ([platform isEqualToString:@"iPad2,6"]) return @"iPad mini (GSM)";
if ([platform isEqualToString:@"iPad2,7"]) return @"iPad mini (GSM+CDMA)";
if ([platform isEqualToString:@"iPad3,1"]) return @"iPad 3 (WiFi)";
if ([platform isEqualToString:@"iPad3,2"]) return @"iPad 3 (GSM+CDMA)";
if ([platform isEqualToString:@"iPad3,3"]) return @"iPad 3 (GSM)";
if ([platform isEqualToString:@"iPad3,4"]) return @"iPad 4 (WiFi)";
if ([platform isEqualToString:@"iPad3,5"]) return @"iPad 4 (GSM)";
if ([platform isEqualToString:@"iPad3,6"]) return @"iPad 4 (GSM+CDMA)";
if ([platform isEqualToString:@"i386"]) return @"Simulator";
if ([platform isEqualToString:@"x86_64"]) return @"Simulator";
return platform;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment