是否可以使用Xcode配置或其他方法仅定位金色iPhone?
答案 0 :(得分:0)
无法通过公共API以编程方式检测iOS设备颜色。 不过,你可以使用私人的。 根据@Ortwin Gentz的回答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"]);
}