UIDevice *device = [UIDevice currentDevice];
SEL selector = NSSelectorFromString(@"deviceInfoForKey:");
if(![devicerespondsToSelector:selector]) {
selector =NSSelectorFromString(@"_deviceInfoForKey:");
}
if([devicerespondsToSelector:selector]) {
//消除警告"performSelector may cause a Leak because its selector is unknown"
IMPimp = [devicemethodForSelector: selector] ;
NSString* (*func)(id,SEL,NSString*) = (void*)imp;
NSString*deviceColor = func(device, selector,@"DeviceColor");
NSString*deviceEnclosureColor = func(device, selector,@"DeviceEnclosureColor");
NSLog(@"deviceColor --> %@ \n @\"deviceEnclosureColor -->%@",deviceColor, deviceEnclosureColor);
}