Asyncdisplaykit: Gif not animated in master branch for sample ASAnimatedImage

Created on 14 Dec 2016  路  14Comments  路  Source: facebookarchive/AsyncDisplayKit

After i upgrade the AsyncDisplaykit from 1.9.81 to 2.0(or latest master branch) , looks like the gif is not working anymore.

Below is issue screenshot that looks like only show first frame of this gif
simulator screen shot 14 dec 2016 3 28 08 pm

Also in 1.9.82 , the gif will overlap the image node like below , which is why i try to solve it by upgrading AsyncDisplayKit version.

The code is:

ASNetworkImageNode *imageNode = [[ASNetworkImageNode alloc] init];
  imageNode.URL = [NSURL URLWithString:@"https://s-media-cache-ak0.pinimg.com/originals/07/44/38/074438e7c75034df2dcf37ba1057803e.gif"];
    imageNode.frame = CGRectMake(50, 50, 200, 200);
    imageNode.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    imageNode.contentMode = UIViewContentModeScaleAspectFill;
    imageNode.borderWidth = 2;
    imageNode.borderColor = [[UIColor blackColor] CGColor];

  [self.view addSubnode:imageNode];

simulator screen shot 14 dec 2016 2 36 22 pm

Most helpful comment

@mikengyn it's fixed in PINRemoteImage if you include master. I'll do a release there soon and then we'll bundle it up in ASDK. Likely 2.1.1

All 14 comments

After debugging into the code i found that the animatedImage property on ASNetworkImageNode will be set to nil in latest master branch , which is not the case in 1.9.81

#pragma mark - Public methods -- must lock

/// Setter for public image property. It has the side effect to set an internal _imageWasSetExternally that prevents setting an image internally. Setting an image internally should happen with the _setImage: method
- (void)setImage:(UIImage *)image
{
  ASDN::MutexLocker l(__instanceLock__);

  _imageWasSetExternally = (image != nil);
  if (_imageWasSetExternally) {
    [self _cancelDownloadAndClearImage];
    _URL = nil;
  }

  [self _setImage:image];
}

Above is the setImage: method in ASNetworkImageNode that override setImage: in ASImageNode,
and [self _cancelDownloadAndClearImage]; will clear the animatedImage , is that the reason why the gif can't play correctly anymore?

@xiaomaogong did you fix this problem? My gif doesn't load at all.

NO. I still can't load gif in latest version.

Having issues with this myself as well.

Looks like its working in 2.1 version now , will close it

The issue persists for ios 9 versions.
Here is a link to a small sample app that reproduces the issue:
https://drive.google.com/file/d/0B05hQ25cGDZydXRXa2xGZHBEOUU/view?usp=sharing

Still broken for me... but worked randomly in some instances.

@mikengyn it's fixed in PINRemoteImage if you include master. I'll do a release there soon and then we'll bundle it up in ASDK. Likely 2.1.1

@garrettmoon That'd be swell. Thanks.

@davitPiloyan93 I tried running your sample app and tried it with an HTTPS resource instead and it works fine for me. https://media.giphy.com/media/l0Ex3vQtX5VX2YtAQ/source.gif

@phuson I check this url https://media.giphy.com/media/l0Ex3vQtX5VX2YtAQ/source.gif
in my device,but still cannot load gif.
My device iphone 6s version 9.3.3

@davitPiloyan93 Ahh, that's odd. You might want to also try what @garrettmoon suggested above (https://github.com/facebook/AsyncDisplayKit/issues/2769#issuecomment-278460946). It works great for me.

@phuson Thanks

@garrettmoon This issue does still exist in 2.1 , the reason why i found its resolved is because that I have the gif cache for working version(1.9.81).

Anyway , I'm very glad to heard that it will be fixed in next release version.

Was this page helpful?
0 / 5 - 0 ratings