Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sdwebimage: is there a limit on how many setimageWithUrl can be queued?

Tags:

ios

sdwebimage

i'm wondering if there is an upper limit on how many setImageWithUrl messages can be submitted at one time ?i'm trying to load 30 photos , 10 of them are downloaded successful but the others entered in the requestFailed when trying to debug the issue

any hints or clarification ? Thanks

like image 559
Y2theZ Avatar asked Jul 09 '12 13:07

Y2theZ


2 Answers

For those who would come here seeking the answer about maximum number of concurrent downloads in SDWebImage, I would like to add to the previous answer.

I would not recommend changing init of SDWebImageDownloader, as you might want to update the SDWebImage or, like me, adjust the number of concurrent downloads in different areas of your app.

//thumbnails.m
//Loading thumbnails. It is faster to load them concurrently
SDWebImageManager.sharedManager.imageDownloader.maxConcurrentDownloads = 10;
[yourImageView setImageWithURL:thumbURL];

//fullScreen.m
//Loading big images in full-screen view, 
SDWebImageManager *sharedManager = [SDWebImageManager sharedManager];
[sharedManager.imageDownloader setMaxConcurrentDownloads:1];
[sharedManager cancelAll]; //cancel all current queue 
[yourImageView setImageWithURL:URL];
like image 58
volodymyr Avatar answered Oct 03 '22 08:10

volodymyr


Though your problem was due to incorrect urls as you mentioned, I am answering this for others who come in looking for the answer:

One can set the maximum concurrent download count in the latest release of SDWebImage framework by setting the variable, downloadQueue.maxConcurrentOperationCount in the init of SDWebImageDownloader. this would limit the maximum number of concurrent downloads for the 'downloadwithURL' call in the application. The framework would put any additional operations in the queue and execute them as the currently executing download completes.

like image 27
user1242321 Avatar answered Oct 03 '22 08:10

user1242321