I had similar problems with
[UIColor colorWithCIColor:[CIColor colorWithString:color]]
Although I was looking for an elegant solution for this, in the end, I decided to solve the problem, which stopped the problem and turned on my application so that it continues exactly the same as before.
My color string was in the same format as yours:
"0.5 0.7 0.2 0.75"
I found the easiest way to fix this was to simply do the following:
NSArray * colorParts = [color componentsSeparatedByString: @" "]; CGFloat red = [[colorParts objectAtIndex:0] floatValue]; CGFloat green = [[colorParts objectAtIndex:1] floatValue]; CGFloat blue = [[colorParts objectAtIndex:2] floatValue]; CGFloat alpha = [[colorParts objectAtIndex:3] floatValue]; UIColor * newColor = [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
Manually separate each value and then insert it into the colorWithRed: code.
This means that you can save your color bar, but get rid of the problematic colorWithString code that causes all the crashes.
Hope this helps
source share