nicklockwood / AsyncImageView

[DEPRECATED]
http://charcoaldesign.co.uk/source/cocoa#asyncimageview
Other
906 stars 186 forks source link

Multiple calls to "loadImageWithURL: target: action:" does not always call action #43

Open rcilia opened 10 years ago

rcilia commented 10 years ago

When I call "loadImageWithURL: target: action:" multiple times, the action is not triggered for each call. (if I add a "failure" selector, it is not called either).

Here is my code:

for (id item in urls) {
    NSURL *url = [[NSURL alloc] initWithString:(NSString *)item];
    [[AsyncImageLoader sharedLoader]
                         loadImageWithURL:url
                         target:self
                         action:@selector(loadImage:withURL:)];
 }

In my code, "urls" contains around 10 Strings, mais the "loadImage:withURL:" selector is called only 3 or 4 times (and if I add a failure selector, it's never called).

I think it's because of a max number of connections, but I expected them to be queued, or maybe I am doing something wrong.

Thanks

LouisBorlee commented 10 years ago

Hello,

I have the (nearly exact) same issue, trying to pre-load 8 images in a UITableView heightForRowAtIndexPath but only got between 2 and 4 callbacks. I'd like to know if you have worked on this issue or, as rcilia says, if I do something wrong.

Thank you.

adeljodalah commented 10 years ago

@nicklockwood what is the solution for this problem , in addition i need to load multiple images using [AsyncImageLoader sharedLoader] and need a way like tag number or something to differentiate between images .. any help please..

@nicklockwood
http://stackoverflow.com/questions/25433426/load-multiple-images-using-asyncimageloader-ios

fraserscottmorrison commented 9 years ago

I have the same issue: loadImage:withURL: is often never called. Usually Im only loading a few images at a time so probably not a max connection thing. The failed handler isn't called either

To work around I scheduled a second call to loadImageWithURL:url with a delay which mostly works. It caused loadImage:withURL: to occasionally get called over and over again so I have to also call cancelLoadingURL:url when successful. Now Im getting random self.collection was mutated while being enumerated exceptions sigh

I think it'd be better to have another loadImageWithURL method that executes a block rather than a callback