When I add UIColor objects into array i got Thread1: Program received signal: “SIGBRT” this error.
NSMutableArray *array =[[NSMutableArray alloc] init];
UIColor *color1,*color2, *color3,*color4;
color1 = [UIColor blueColor];
color2 = [UIColor colorWithHue:0.5
saturation:0.1
brightness:0.2
alpha:1.0];
color3 = color2;
[array addObject:color1];//No Problem
[array addObject:color2];//No Problem
[array addObject:color3];//No Problem
[array addObject:color4];//Problem is here.....
When I add first three objects into array there is no problem. But when i add last object i get error. What is the problem in this code? Should i assign any thing to fourth object(color4) like first three objects? Is it necessary? Why?…
Please suggest me with example. Thanks in advance.
color4 is not initialized and you try to insert nil in your array. Initialize color4 like the other colors.