title: Draw a line in iPhone , Exception
body: <p>Im trying to draw a line. </p>
  
  <p>I wrote a code like below.</p>
  
  <pre><code>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);
  </code></pre>
  
  <p>but this shows exception as follows</p>
  
  <pre><code>Sat Aug 21 10:47:20 AAA-rrr-Mac-mini.local Test[2147] &lt;Error&gt;: CGContextSetLineWidth: invalid context 0x0
  Sat Aug 21 10:47:20 AAA-rrr-Mac-mini.local Test[2147] &lt;Error&gt;: CGContextSetStrokeColorWithColor: invalid context 0x0
  Sat Aug 21 10:47:20 AAA-rrr-Mac-mini.local Test[2147] &lt;Error&gt;: CGContextMoveToPoint: invalid context 0x0
  Sat Aug 21 10:47:20 AAA-rrr-Mac-mini.local Test[2147] &lt;Error&gt;: CGContextAddLineToPoint: invalid context 0x0
  Sat Aug 21 10:47:20 AAA-rrr-Mac-mini.local Test[2147] &lt;Error&gt;: CGContextDrawPath: invalid context 0x0
  </code></pre>