My app is drawing a shadow using the following code:
-(void)drawShadow:(CGContextRef)context rect:(CGRect)rect{
CGContextSaveGState(context);
//Set color of current context
[[UIColor blackColor] set];
//Set shadow and color of shadow
CGContextSetShadowWithColor(context, CGSizeMake(0, 2), 3, [[UIColor colorWithWhite:0 alpha:0.5] CGColor]);
CGContextFillEllipseInRect(context, rect);
CGContextClipToMask(context, rect, CGBitmapContextCreateImage(context));
CGContextRestoreGState(context); // Warning shows in this line
}
When I run Product > Analyze, it marks the last instruction of this block with the message: "Potential leak of an object". When I remove that line, it shows the same message but in the closing bracket.
Any idea of what I'm doing wrong?
Thanks