开发者

Anyone noticed images fail to load after network interruption?

I just noticed that when you get a network interruption the code proposed by Apple fails to load the images ... It works p开发者_如何学JAVAerfectly otherwise though ;)

It is due to the fact that IconDownloader doesn't do anything if NSURL connection fails ...

Before I struggle with this on my own, anyone has any tips for me :D ?

Thanks a lot,

Gotye.


==> i think this is what we can do to download if nsurlconnection method get fail with connection

  - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error

{
          // Clear the activeDownload property to allow later attempts
            self.activeDownload = nil;

          // Release the connection now that it's finished
       self.imageConnection = nil;


  //i think we can call the connection method again from here

       self.activeDownload = [NSMutableData data];
          // alloc+init and start an NSURLConnection; release on completion/failure
       NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:
                         [NSURLRequest requestWithURL:
                          [NSURL URLWithString:appRecord.imageURLString]] delegate:self];
       self.imageConnection = conn;
       [conn release];



}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜