Permalink
Browse files

Added program support for unknown iPod/iPhone

  • Loading branch information...
1 parent 3f098a8 commit 8b076c66aedfd6ebf969581a56fa8106a9a35e58 Erica Sadun committed Mar 5, 2009
Showing with 12 additions and 0 deletions.
  1. +2 −0 UIDevice-hardware.h
  2. +10 −0 UIDevice-hardware.m
View
@@ -2,8 +2,10 @@
#define IPHONE_1G_NAMESTRING @"iPhone 1G"
#define IPHONE_3G_NAMESTRING @"iPhone 3G"
+#define IPHONE_UNKNOWN_NAMESTRING @"Unknown iPhone"
#define IPOD_1G_NAMESTRING @"iPod touch 1G"
#define IPOD_2G_NAMESTRING @"iPod touch 2G"
+#define IPOD_UNKNOWN_NAMESTRING @"Unknown iPod"
typedef enum {
UIDeviceUnknown,
View
@@ -32,6 +32,8 @@ - (int) platformType
if ([platform isEqualToString:@"iPhone1,2"]) return UIDevice3GiPhone;
if ([platform isEqualToString:@"iPod1,1"]) return UIDevice1GiPod;
if ([platform isEqualToString:@"iPod2,1"]) return UIDevice2GiPod;
+ if ([platform hasPrefix:@"iPhone"]) return UIDeviceUnknowniPhone;
+ if ([platform hasPrefix:@"iPod"]) return UIDeviceUnknowniPod;
return UIDeviceUnknown;
}
@@ -41,8 +43,12 @@ - (NSString *) platformString
{
case UIDevice1GiPhone: return IPHONE_1G_NAMESTRING;
case UIDevice3GiPhone: return IPHONE_3G_NAMESTRING;
+ case UIDeviceUnknowniPhone: return IPHONE_UNKNOWN_NAMESTRING;
+
case UIDevice1GiPod: return IPOD_1G_NAMESTRING;
case UIDevice2GiPod: return IPOD_2G_NAMESTRING;
+ case UIDeviceUnknowniPod: return IPOD_UNKNOWN_NAMESTRING;
+
default: return nil;
}
}
@@ -53,8 +59,12 @@ - (int) platformCapabilities
{
case UIDevice1GiPhone: return UIDeviceBuiltInSpeaker | UIDeviceBuiltInCamera | UIDeviceBuiltInMicrophone | UIDeviceSupportsExternalMicrophone | UIDeviceSupportsTelephony;
case UIDevice3GiPhone: return UIDeviceSupportsGPS | UIDeviceBuiltInSpeaker | UIDeviceBuiltInCamera | UIDeviceBuiltInMicrophone | UIDeviceSupportsExternalMicrophone | UIDeviceSupportsTelephony;
+ case UIDeviceUnknowniPhone: return UIDeviceBuiltInSpeaker | UIDeviceBuiltInCamera | UIDeviceBuiltInMicrophone | UIDeviceSupportsExternalMicrophone | UIDeviceSupportsTelephony;
+
case UIDevice1GiPod: return 0;
case UIDevice2GiPod: return UIDeviceBuiltInSpeaker | UIDeviceBuiltInMicrophone | UIDeviceSupportsExternalMicrophone;
+ case UIDeviceUnknowniPod: return 0;
+
default: return 0;
}
}

0 comments on commit 8b076c6

Please sign in to comment.