Detecting Color of iPhone/iPad/iPod touch?
There's a private API to retrieve both the DeviceColor
and the DeviceEnclosureColor
.
UIDevice *device = [UIDevice currentDevice];
SEL selector = NSSelectorFromString(@"deviceInfoForKey:");
if (![device respondsToSelector:selector]) {
selector = NSSelectorFromString(@"_deviceInfoForKey:");
}
if ([device respondsToSelector:selector]) {
NSLog(@"DeviceColor: %@ DeviceEnclosureColor: %@", [device performSelector:selector withObject:@"DeviceColor"], [device performSelector:selector withObject:@"DeviceEnclosureColor"]);
}
I've blogged about this and provide a sample app:
http://www.futuretap.com/blog/device-colors/
Warning: As mentioned, this is a private API. Don't use this in App Store builds.
The answer to the question is NO (as of now) and personally I don't think it's worth much, because what if the end-user uses a skin or an additional casing for his iPhone?
I'd suggest to initially ask the user "Hey, what's the color of your phone?" and then do accordingly.
Additionally, a research provided me with this information, I'm not sure if it's TRUE or if is going to help you.
The serial number is the key :)
If aabccdddeef
is the serial number of the iPhone 4, ee
represents the Color, (A4=black). I hope some of you here check this information with yours to see if this is true.