Recently I encountered some code where trying to get the CIColor property of a UIColor fails. The UIColor was initialized as a simple [UIColor blackColor] and trying to get the
The documentation for the CIColor
property on UIImage says:
This property throws an exception if the color object was not initialized with a Core Image color.
So if you want to access a UIColor's CIColor, it needs to have been created from a CIColor in the first place.
On the other hand, you can make a new CIColor from any UIColor using the initWithColor:
initializer:
CIColor *color = [[CIColor alloc] initWithColor:UIColor.blackColor];