Is it possible to use Xcode configurations or some other method to target only a gold iPhone?
Asked
Active
Viewed 149 times
-3
-
Are you serious? Who got such a golden iPhone? – MasterRazer Oct 02 '13 at 22:54
-
Downvotes seem inappropriate here-- although the answer may be obvious to any seasoned iOS developer, this question is valid, on-topic, about programming, and not a duplicate. – Ben Zotto Oct 02 '13 at 23:02
-
@TaylorHalliday Do you mean the gold colored iPhone 5s? – rmaddy Oct 02 '13 at 23:02
-
Yes - on the grammar thing I was just messing around. But, yes. I was joking around with someone about how ridiculous it would be if you possibly make a app that only worked on a Gold iPhone 5S. Seemed like a funny concept. Even though I doubted it - decided to throw it out on SO to see if it was possible. Didn't mean to offend any devs by asking - just wondering if there was something that I wasn't thinking of. – Taylor Halliday Oct 02 '13 at 23:04
-
Throwing it out there - How is this question down voted, but the link to the SO Q above this comment received so much positive attention. They get at the same technical Q - detecting cosmetics on the device. – Taylor Halliday Oct 03 '13 at 17:33
1 Answers
0
It is not possible to detect iOS device colour programmatically via public APIs. Still, you could use private ones. According to @Ortwin Gentz's answer here:
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"]);
}

Community
- 1
- 1

FreeNickname
- 7,398
- 2
- 30
- 60