는 갑자기Obj-C,이 시점에서 호출자가 소유하지 않은 개체의 참조 횟수가 잘못 지정 되었습니까?
Incorrect decrement of the reference count of an object that is not owned at this point by the caller
어떤 아이디어를 업그레이드 한 후이 경고를 받고 있어요?
+ (void) drawGradientInRect:(CGRect)rect withColors:(NSArray*)colors{
NSMutableArray *ar = [NSMutableArray array];
for(UIColor *c in colors){
[ar addObject:(id)c.CGColor];
}
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
CGColorSpaceRef colorSpace = CGColorGetColorSpace([[colors lastObject] CGColor]);
CGGradientRef gradient = CGGradientCreateWithColors(colorSpace, (CFArrayRef)ar, NULL);
CGContextClipToRect(context, rect);
CGPoint start = CGPointMake(0.0, 0.0);
CGPoint end = CGPointMake(0.0, rect.size.height);
CGContextDrawLinearGradient(context, gradient, start, end, kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation);
CGColorSpaceRelease(colorSpace); //on this line
CGGradientRelease(gradient);
CGContextRestoreGState(context);
}