Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added iPod 5th gen and iPad mini, fixed iPad 4th gen #25

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions UIDevice-Hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
#define IPOD_2G_NAMESTRING @"iPod touch 2G"
#define IPOD_3G_NAMESTRING @"iPod touch 3G"
#define IPOD_4G_NAMESTRING @"iPod touch 4G"
#define IPOD_5G_NAMESTRING @"iPod touch 5G"
#define IPOD_UNKNOWN_NAMESTRING @"Unknown iPod"

#define IPAD_1G_NAMESTRING @"iPad 1G"
#define IPAD_2G_NAMESTRING @"iPad 2G"
#define IPAD_3G_NAMESTRING @"iPad 3G"
#define IPAD_4G_NAMESTRING @"iPad 4G"
#define IPADMINI_1G_NAMESTRING @"iPad mini 1G"
#define IPAD_UNKNOWN_NAMESTRING @"Unknown iPad"

#define APPLETV_2G_NAMESTRING @"Apple TV 2G"
Expand Down Expand Up @@ -59,12 +61,15 @@ typedef enum {
UIDevice2GiPod,
UIDevice3GiPod,
UIDevice4GiPod,
UIDevice5GiPod,

UIDevice1GiPad,
UIDevice2GiPad,
UIDevice3GiPad,
UIDevice4GiPad,

UIDevice1GiPadMini,

UIDeviceAppleTV2,
UIDeviceAppleTV3,
UIDeviceAppleTV4,
Expand Down
26 changes: 21 additions & 5 deletions UIDevice-Hardware.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,23 @@ @implementation UIDevice (Hardware)
iPod2,2 -> Unknown, ??
iPod3,1 -> iPod touch 3G, N18
iPod4,1 -> iPod touch 4G, N80
iPod5,1 -> iPod touch 5G

// Thanks NSForge
iPad1,1 -> iPad 1G, WiFi and 3G, K48
iPad2,1 -> iPad 2G, WiFi, K93
iPad2,2 -> iPad 2G, GSM 3G, K94
iPad2,3 -> iPad 2G, CDMA 3G, K95
iPad2,4 -> iPad 2G, WiFi, K93
iPad2,5 -> iPad mini 1G, WiFi, K93
iPad2,6 -> iPad mini 1G, GSM, K93
iPad2,7 -> iPad mini 1G, CDMA, K93
iPad3,1 -> (iPad 3G, WiFi)
iPad3,2 -> (iPad 3G, GSM)
iPad3,3 -> (iPad 3G, CDMA)
iPad4,1 -> (iPad 4G, WiFi)
iPad4,2 -> (iPad 4G, GSM)
iPad4,3 -> (iPad 4G, CDMA)
iPad3,4 -> (iPad 4G, WiFi)
iPad3,5 -> (iPad 4G, GSM)
iPad3,6 -> (iPad 4G, CDMA)

AppleTV2,1 -> AppleTV 2, K66
AppleTV3,1 -> AppleTV 3, ??
Expand Down Expand Up @@ -167,12 +172,22 @@ - (NSUInteger) platformType
if ([platform hasPrefix:@"iPod2"]) return UIDevice2GiPod;
if ([platform hasPrefix:@"iPod3"]) return UIDevice3GiPod;
if ([platform hasPrefix:@"iPod4"]) return UIDevice4GiPod;
if ([platform hasPrefix:@"iPod5"]) return UIDevice5GiPod;

// iPad mini
if ([platform hasPrefix:@"iPad2,5"]) return UIDevice1GiPadMini;
if ([platform hasPrefix:@"iPad2,6"]) return UIDevice1GiPadMini;
if ([platform hasPrefix:@"iPad2,7"]) return UIDevice1GiPadMini;

// iPad
if ([platform hasPrefix:@"iPad1"]) return UIDevice1GiPad;
if ([platform hasPrefix:@"iPad2"]) return UIDevice2GiPad;
if ([platform hasPrefix:@"iPad3"]) return UIDevice3GiPad;
if ([platform hasPrefix:@"iPad4"]) return UIDevice4GiPad;
if ([platform hasPrefix:@"iPad3,1"]) return UIDevice3GiPad;
if ([platform hasPrefix:@"iPad3,2"]) return UIDevice3GiPad;
if ([platform hasPrefix:@"iPad3,3"]) return UIDevice3GiPad;
if ([platform hasPrefix:@"iPad3,4"]) return UIDevice4GiPad;
if ([platform hasPrefix:@"iPad3,5"]) return UIDevice4GiPad;
if ([platform hasPrefix:@"iPad3,6"]) return UIDevice4GiPad;

// Apple TV
if ([platform hasPrefix:@"AppleTV2"]) return UIDeviceAppleTV2;
Expand Down Expand Up @@ -215,6 +230,7 @@ - (NSString *) platformString
case UIDevice2GiPad : return IPAD_2G_NAMESTRING;
case UIDevice3GiPad : return IPAD_3G_NAMESTRING;
case UIDevice4GiPad : return IPAD_4G_NAMESTRING;
case UIDevice1GiPadMini : return IPADMINI_1G_NAMESTRING;
case UIDeviceUnknowniPad : return IPAD_UNKNOWN_NAMESTRING;

case UIDeviceAppleTV2 : return APPLETV_2G_NAMESTRING;
Expand Down