Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs #7

Open
pronebird opened this issue Mar 23, 2015 · 9 comments
Open

Bugs #7

pronebird opened this issue Mar 23, 2015 · 9 comments

Comments

@pronebird
Copy link

  1. pod try RJImageLoader opens broken project.
  2. trying out pod in app, animation runs once, then on second run it is inversed and finally after that it's completely gone.

I made a small video: http://cl.ly/1y0G1p050o0M. I think the problem is in SDWebImage:

    self.photoImageView.image = nil;

    [self.photoImageView startLoaderWithTintColor:[UIColor blueColor]];
    NSLog(@"Start loader");

    __weak typeof(self) weakSelf = self;
    [self.photoImageView sd_setImageWithURL:url
                           placeholderImage:nil
                                    options:SDWebImageRetryFailed | SDWebImageRefreshCached
                                   progress:^(NSInteger receivedSize, NSInteger expectedSize) {
                                       dispatch_async(dispatch_get_main_queue(), ^{
                                           CGFloat percent = (CGFloat)receivedSize / expectedSize;
                                           [weakSelf.photoImageView updateImageDownloadProgress:percent];
                                           NSLog(@"Update progress = %f", percent);
                                       });
                                   }
                                  completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
                                    [weakSelf.photoImageView reveal];
                                    NSLog(@"Reveal loader");
                                  }];

I posted couple of issues in SDWebImage related to this problem. SDWebImage/SDWebImage#1090

Since SDWebImage is a wreck, we can avoid completion handler and run all animations in progress block:

    self.photoImageView.image = nil;

    [self.photoImageView startLoaderWithTintColor:[UIColor blueColor]];
    NSLog(@"Start loader");

    __weak typeof(self) weakSelf = self;
    [self.photoImageView sd_setImageWithURL:url
                           placeholderImage:nil
                                    options:SDWebImageRetryFailed | SDWebImageRefreshCached
                                   progress:^(NSInteger receivedSize, NSInteger expectedSize) {
                                       dispatch_async(dispatch_get_main_queue(), ^{
                                           CGFloat percent = (CGFloat)receivedSize / expectedSize;
                                           [weakSelf.photoImageView updateImageDownloadProgress:percent];
                                           NSLog(@"Update progress = %f", percent);

                                           if(receivedSize == expectedSize) {
                                               [weakSelf.photoImageView reveal];
                                           }
                                       });
                                   }
                                  completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
                                  }];

But then it's all broken after I run it twice, see video: http://cl.ly/2U192i321D1N

@pronebird pronebird changed the title It does not work, at all Bugs Mar 23, 2015
@rounak
Copy link
Owner

rounak commented Mar 25, 2015

This is very weird. By second run, do you mean a build and run second time, or something else?

@pronebird
Copy link
Author

By second run I meant as if I ran the same start/update/reveal cycle once again on the same image view.

@rounak
Copy link
Owner

rounak commented Mar 25, 2015

Ah, ok. Got it. I think we can fix this by doing some more cleanup at the end of reveal. (Resetting progress back to 0, possibly removing from superview) I'll take a look at this over the weekend.

@pronebird
Copy link
Author

@rounak thank you! I had something like that in mind and I tried to remove view from superview but I guess it needs more thorough clean up.

@LiuSky
Copy link

LiuSky commented May 8, 2015

There are still similar problems in the list when multiplexing

@cyril94440
Copy link

I have the same issue, what is the workaround?

@chinnuios
Copy link

@pronebird I have the same issue, what is the workaround?

@hyunwoo3008
Copy link

I have the same issue,,

@chinnuios
Copy link

chinnuios commented Apr 23, 2016

@rounak @hyunwoo3008 did you resolved this issue ?? if yes, please tell me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants