- (void)jh_deviceColor{
UIDevice *device = [UIDevice currentDevice];
SEL selector = NSSelectorFromString(@"deviceInfoForKey:");
if (![device respondsToSelector:selector]) {
selector = NSSelectorFromString(@"_deviceInfoForKey:");
if ([device respondsToSelector:selector]) {
IMP imp = [device methodForSelector:selector];
NSString *(*func)(id ,SEL, NSString*) = (void *)imp;
NSString *deviceColor = func(device,selector,@"DeviceColor");
NSString *deviceEnclosureColor = func(device, selector, @"DeviceEnclosureColor");
NSLog(@"deviceColor:%@,deviceEnclosureColor:%@", deviceColor,deviceEnclosureColor);
}
}
}
网友评论