drawRect and dispatch context error 0x0
<p>I'm trying to create custom view that draws image downloaded from Url.
The code is:</p>

<pre><code>- (void)drawRect:(CGRect)rect
{
    CGContextRef context = UIGraphicsGetCurrentContext();

    dispatch_queue_t downloadImgQueue = dispatch_queue_create("imgDownload", NULL);
    dispatch_async(downloadImgQueue, ^{



        CGRect myViewSize = CGRectMake(0, 0, 100, 100);


        NSURL *url = [NSURL URLWithString:@"http://www.mytripolog.com/wp-content/uploads/2011/05/large-big-size-world-political-map.jpg"];

        UIImage *image = [UIImage imageWithData: [NSData dataWithContentsOfURL:url]];

        dispatch_async(dispatch_get_main_queue(),^{

            [image drawInRect:myViewSize];

        });

    });    
    dispatch_release(downloadImgQueue);

}
</code></pre>

<p>But this doesn't work. I Get errors:</p>

<pre><code>Dec 20 14:31:31 Mac.local AdSdk[1736] &lt;Error&gt;: CGContextSaveGState: invalid context 0x0
Dec 20 14:31:31 Mac.local AdSdk[1736] &lt;Error&gt;: CGContextSetBlendMode: invalid context 0x0
Dec 20 14:31:31 Mac.local AdSdk[1736] &lt;Error&gt;: CGContextSetAlpha: invalid context 0x0
Dec 20 14:31:31 Mac.local AdSdk[1736] &lt;Error&gt;: CGContextTranslateCTM: invalid context 0x0
Dec 20 14:31:31 Mac.local AdSdk[1736] &lt;Error&gt;: CGContextScaleCTM: invalid context 0x0
Dec 20 14:31:31 Mac.local AdSdk[1736] &lt;Error&gt;: CGContextDrawImage: invalid context 0x0
Dec 20 14:31:31 Mac.local AdSdk[1736] &lt;Error&gt;: CGContextRestoreGState: invalid context 0x0
</code></pre>

<p>What should I change to make this work ?</p>
