Im trying to draw a line .
I wrote a code like below.
UIColor *currentColor = [UIColor blackColor];
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 2.0);
CGContextSetStrokeColorWithColor(context, currentColor.CGColor);
CGContextMoveToPoint(context, startingPoint.x, startingPoint.y);
CGContextAddLineToPoint(context,endingPoint.x , endingPoint.y);
CGContextStrokePath(context);
but this shows exception as follows
Sat Aug 21 10:47:20 AAA-rrr-Mac-mini.local Test[2147] : CGContextSetLineWidth: invalid context 0x0 Sat Aug 21 10:47:20 AAA-rrr-Mac-mini.local Test[2147] : CGContextSetStrokeColorWithColor: invalid context 0x0 Sat Aug 21 10:47:20 AAA-rrr-Mac-mini.local Test[2147] : CGContextMoveToPoint: invalid context 0x0 Sat Aug 21 10:47:20 AAA-rrr-Mac-mini.local Test[2147] : CGContextAddLineToPoint: invalid context 0x0 Sat Aug 21 10:47:20 AAA-rrr-Mac-mini.local Test[2147] : CGContextDrawPath: invalid context 0x0