I have the following test code:
CGFloat endRed, endGreen, endBlue, endAlpha;
[[UIColor greenColor] getRed:&endRed green:&endGreen blue:&endBlue alpha:&endAlpha];
that I call inside drawRect method for an UIView class.
This code fails with exception
2011-11-06 02:29:28.671 Chartous[13457:b303] -[UICachedDeviceRGBColor getRed:green:blue:alpha:]: unrecognized selector sent to instance 0x4e7ea10
2011-11-06 02:29:28.673 Chartous[13457:b303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UICachedDeviceRGBColor getRed:green:blue:alpha:]: unrecognized selector sent to instance 0x4e7ea10'
What is wrong here?
This method is available in ios5 and later only. Are you running it on an earlier iOS version on the simulator or device? I assume so given the tag on your question.