Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting Color of iPhone/iPad/iPod touch?

Is there any way or hack to detect on what color (black / white) iPhone, iPad or iPod touch the iOS is installed?

I want to load corresponding UI skins in case of Black or White devices.

like image 273
totocaster Avatar asked Dec 11 '11 10:12

totocaster


2 Answers

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.

like image 80
Ortwin Gentz Avatar answered Sep 23 '22 18:09

Ortwin Gentz


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.

like image 34
COD3BOY Avatar answered Sep 22 '22 18:09

COD3BOY