Code Monkey home page Code Monkey logo

yyimage's People

Contributors

backworld avatar fysteven avatar ibireme avatar middaparka avatar nivl4 avatar revolter avatar sergiochan avatar stanmots avatar yuao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yyimage's Issues

README typo

In README.md there's:

NSData *data = [NSData dataWithContentOfFile:@"/tmp/image.webp"];

In which dataWithContentOfFile should be dataWithContentsOfFile obviously.

issue:Multiple locks on web thread not allowed!

求助:加载图片进度条展示使用UCZProgressView,使用后会出现WTFCrash
2016-08-12 14:11:46.978 mode[17853:573412] bool _WebTryThreadLock(bool), 0x7fc0828f7300: Multiple locks on web thread not allowed! Please file a bug. Crashing now... 1 0x10aabe34e WebRunLoopLock(__CFRunLoopObserver*, unsigned long, void*) 2 0x1066acc37 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ 3 0x1066acba7 __CFRunLoopDoObservers 4 0x1066a26c4 __CFRunLoopRun 5 0x1066a20f8 CFRunLoopRunSpecific 6 0x10aabe325 RunWebThread(void*) 7 0x10773599d _pthread_body 8 0x10773591a _pthread_body 9 0x107733351 thread_start
screen shot 2016-08-12 at 2 24 41 pm
screen shot 2016-08-12 at 2 23 00 pm

项目里所有的 webp 解析出来的 image均为空(nil), 同 #11,但原因似乎不同, android 使用 Fresco解析正常

notdisplay_1.webp.zip

RT, 我们服务器使用的图片是七牛那边的,转换为webp格式的,之前一直使用 SDWebImage 可以正常显示。
尝试使用 YYImage 或者直接使用 YYWebImage 均如此。

  1. 我看了#11,并且 在引用到了VP8_STATUS_NOT_ENOUGH_DATA做判断的地方都打了断点,并没有走到:
    YYCGImageCreateWithWebPData 和 _newUnblendedImageAtIndex
  2. YYImageDecoder 通过 _frameAtIndex 获取到的 YYImageFrame 为 nil, 跟进去看到 frame.blendFromIndex = 1,同时frame.index = 0,导致不会走以下循环
for (uint32_t i = (uint32_t)frame.blendFromIndex; i <= (uint32_t)frame.index; i++) {
                if (i == frame.index) {
                    if (!imageRef) imageRef = [self _newBlendedImageWithFrame:frame];
                } else {
                    [self _blendImageWithFrame:_frames[i]];
                }
            }

最终走到空的 imageRef

if (!imageRef) return nil;
  1. 另外尝试了服务器提供的 webp 格式的动图,一样无法解析,没有跟进,推测跟静态 webp 解析失败有关
  2. 同样的静态 webp 和动态 webp,android 那边使用 facebook 开源的Fresco均能正常解析显示

Wrong code in YYImageCoder.m

The code below in YYImageCode.m at line 1405-1415
The buffer named "tmp" is never used, please fix.
And the code segment is never run...

`
if (iter.x_offset != 0 || iter.y_offset != 0) {

void *tmp = calloc(1, destLength);

if (tmp) {

    vImage_Buffer src = {destBytes, canvasHeight, canvasWidth, bytesPerRow};

    vImage_Buffer dest = {destBytes, canvasHeight, canvasWidth, bytesPerRow};

    vImage_CGAffineTransform transform = {1, 0, 0, 1, iter.x_offset, -iter.y_offset};

    uint8_t backColor[4] = {0};

    vImageAffineWarpCG_ARGB8888(&src, &dest, NULL, &transform, backColor, kvImageBackgroundColorFill);

    memcpy(destBytes, tmp, destLength);

    free(tmp);

}

}

`

Memory Leak in 1.0

I am using 1.0 to animate a sequence of PNGs (380 in total @ 60 fps) and have run into serious memory leak issues with that cause the app to crash after a while.

Xcode console first prints this continuously:
<Error>: CGBitmapContextInfoCreate: unable to allocate 3469440 bytes for bitmap data

After a while the more lines appear (again printed continuously):
<Error>: CGBitmapContextInfoCreate: unable to allocate 3469440 bytes for bitmap data
malloc: *** mach_vm_map(size=8388608) failed (error code=3) *** error: can't allocate region securely *** set a breakpoint in malloc_error_break to debug

After a few more seconds of animating the app crashes.

I tried to find the responsible part with Instruments ("Leaks") and found the following leak causing the majority of the memory usage (there are hundreds of UIImages retained):

Collapsed:
bildschirmfoto 2016-03-09 um 13 51 19

Expanded:
bildschirmfoto 2016-03-09 um 13 51 26

Filtered ("unpaired" only):
bildschirmfoto 2016-03-09 um 14 04 35

I tried setting maxBufferSize to a reasonable value, but that didn't help. Any ideas on what might cause the severe leaks?

YYAnimatedImageView play animation from end to start?

How could I implement functionality to make YYAnimatedImageView to play animations in ping pong style? When animation reach a last frame it should continue animating till reach first frame using negative step. This should be continued till total loop count is reached.

Duplicate webp symbols

This Issue is more of an observation than a bug:

Our production project (closed source) has issues linking with WebP when pulled via YYImage. We pull in YYImage+WebP in a subspec of our open source project:
https://github.com/imojiengineering/imoji-ios-sdk/blob/master/ImojiSDK.podspec#L18

I've been able to get this resolved by forking YYImage and recompiling WebP w/o libwebpdecoder here:
https://github.com/imojiengineering/YYImage/commit/b79dd0297c1925940d7470f2147dae909e73e9e6

Note that this only happens for our production project and not any other project. Therefore I'm not sure if there's a project setting we've got misconfigured.

At any rate, the error we were getting suggests that there are duplicate symbols in the WebP build. I'm curious as to why it doesn't fail for other projects.

Message

duplicate symbol _WebPMultRows in:
    /Users/nkhoshini/projects/imoji-ios/Pods/YYImage/Vendor/WebP.framework/WebP(libwebpdsp_la-alpha_processing.o)
    /Users/nkhoshini/projects/imoji-ios/Pods/YYImage/Vendor/WebP.framework/WebP(libwebpdspdecode_la-alpha_processing.o)
duplicate symbol _WebPMultARGBRows in:
    /Users/nkhoshini/projects/imoji-ios/Pods/YYImage/Vendor/WebP.framework/WebP(libwebpdsp_la-alpha_processing.o)
    /Users/nkhoshini/projects/imoji-ios/Pods/YYImage/Vendor/WebP.framework/WebP(libwebpdspdecode_la-alpha_processing.o)
duplicate symbol _WebPInitAlphaProcessing in:
    /Users/nkhoshini/projects/imoji-ios/Pods/YYImage/Vendor/WebP.framework/WebP(libwebpdsp_la-alpha_processing.o)
    /Users/nkhoshini/projects/imoji-ios/Pods/YYImage/Vendor/WebP.framework/WebP(libwebpdspdecode_la-alpha_processing.o)
duplicate symbol _WebPMultRowC in:
    /Users/nkhoshini/projects/imoji-ios/Pods/YYImage/Vendor/WebP.framework/WebP(libwebpdsp_la-alpha_processing.o)
    /Users/nkhoshini/projects/imoji-ios/Pods/YYImage/Vendor/WebP.framework/WebP(libwebpdspdecode_la-alpha_processing.o)

Symbol dump of YYImage/Vendor/WebP.framework/WebP

~$ nm WebP | grep  _WebPMultRows
                 U _WebPMultRows
0000000000000270 T _WebPMultRows
0000000000000270 T _WebPMultRows
                 U _WebPMultRows

Configuration
Xcode 7.3
iOS SDK 9.3
OSX 10.11

使用问题

用Cocoapods集成YYKit后, 在自己工程中通过:

        YYImage *image = [YYImage imageNamed:@"[email protected]"];

来加载Apng文件时, 获取的image中,decoder为nil.
但将文件添加进YYKit-demo中, 通过同样的方法, 可以加载并显示出来.
请问换需要其他配置么?

Carthage issue

Hi,

We're using YYImage with imoji-sdk (https://github.com/alex-hoang/imoji-ios-sdk/tree/carthage).

We're running into an issue trying to enable WebP by default while using the latest YYImage.framework compiled using carthage. With CocoaPods, the WebP dependency works nicely since all the source files are compiled by pod generated workspace. However with Carthage, the WebP dependency doesn't get detected even when added manually.

Any ideas on how to address that? Thanks!

读取Image.xcassets

我测试发现YYImage 现在读取Image.xcassets内的图片是无法读取成功的。

Possible memory leaks

Hello, thanks for making this library!

I'm just referring to FBInfer's report, appreciate it if they can be fixed!

Cheers.
--------------------------------Report begins-----------------------------------------------
Pods/YYImage/YYImage/YYImageCoder.m:663: error: MEMORY_LEAK
memory dynamically allocated by call to YYCGColorSpaceGetDeviceRGB() at line 663, column 36 is not reachable after line 663, column 5
1.
2. BOOL YYCGColorSpaceIsDeviceRGB(CGColorSpaceRef space) {
3. > return space && CFEqual(space, YYCGColorSpaceGetDeviceRGB());
4. }
5.

Pods/YYImage/YYImage/YYImageCoder.m:667: error: MEMORY_LEAK
memory dynamically allocated by call to YYCGColorSpaceGetDeviceGray() at line 667, column 36 is not reachable after line 667, column 5
1.
2. BOOL YYCGColorSpaceIsDeviceGray(CGColorSpaceRef space) {
3. > return space && CFEqual(space, YYCGColorSpaceGetDeviceGray());
4. }
5.

Pods/YYImage/YYImage/YYImageCoder.m:887: error: MEMORY_LEAK
memory dynamically allocated by call to YYCGColorSpaceGetDeviceRGB() at line 887, column 81 is not reachable after line 887, column 32

  1.       CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Host;
    
  2.       bitmapInfo |= hasAlpha ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst;
    
  3.     CGContextRef context = CGBitmapContextCreate(NULL, width, height, 8, 0, YYCGColorSpaceGetDeviceRGB(), bitmapInfo);
    
  4.       if (!context) return NULL;
    
  5.       CGContextDrawImage(context, CGRectMake(0, 0, width, height), imageRef); // decode
    

Pods/YYImage/YYImage/YYImageCoder.m:2055: error: MEMORY_LEAK
memory dynamically allocated by call to YYCGColorSpaceGetDeviceRGB() at line 2055, column 91 is not reachable after line 2055, column 40

  1.               }
    
  2.           } else {
    
  3.             CGContextRef context = CGBitmapContextCreate(NULL, _width, _height, 8, 0, YYCGColorSpaceGetDeviceRGB(), kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst);
    
  4.               if (context) {
    
  5.                   CGContextDrawImage(context, CGRectMake(0, _height - height, width, height), imageRef);
    

Pods/YYImage/YYImage/YYImageCoder.m:2197: error: MEMORY_LEAK
memory dynamically allocated by call to YYCGColorSpaceGetDeviceRGB() at line 2197, column 75 is not reachable after line 2197, column 9

  1.   if (!_blendCanvas) {
    
  2.       _blendFrameIndex = NSNotFound;
    
  3.     _blendCanvas = CGBitmapContextCreate(NULL, _width, _height, 8, 0, YYCGColorSpaceGetDeviceRGB(), kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst);
    
  4.   }
    
  5.   BOOL suc = _blendCanvas != NULL;
    

Pods/YYImage/YYImage/YYImageCoder.m:2416: error: MEMORY_LEAK
memory dynamically allocated to gifProperty by call to alloc() at line 2414, column 37 is not reachable after line 2416, column 9

  1.       NSDictionary *gifProperty = @{(__bridge id)kCGImagePropertyGIFDictionary:
    
  2.                                       @{(__bridge id)kCGImagePropertyGIFLoopCount: @(_loopCount)}};
    
  3.     CGImageDestinationSetProperties(destination, (__bridge CFDictionaryRef)gifProperty);
    
  4.   }
    

IOS9中可以使用pdf格式图片

IOS9中可以使用pdf格式图片,极大的减轻了图片的切图,不用再切@2x,@3x,那么YYImage 是否支持pdf格式图片的加载和优化呢? 我看RM上并没有写着支持,

cache

你的 iOS 处理图片的一些小 Tip 讲 imageWithData不能避免缓存,这里为什么写+ (YYImage *)imageNamed:(NSString *)name; // no cache! 里面也是 initWithData

Support for `imageNamed`

As far as I can tell, there is no support for using xcasset bundles of assets with YYFrameImage
I might need some support for a project I am working on, interested in a pull request if I need it / get it done ?

Frame duration issue on APNG?

When encoding an array of UIImage objects to an APNG file, the code doesn't seem to respect the animation duration set on the final frame. (At least when viewed in Safari on Mac OS X, the animation loops with all frames using the duration of the first frame.)

When I use the same code to encode an animated GIF, the image appears to animate correctly.

Anyone else having this issue?

Alamofire upload

I tried uploading an webp image with Alamofire like that

Alamofire.upload(
        .POST,
    "https://example.com/upload",
    multipartFormData: { multipartFormData in
        multipartFormData.appendBodyPart(data: data, name: "image", fileName: "file.webp", mimeType: "image/webp")
    },
    encodingCompletion: { encodingResult in
        switch encodingResult {
        case .Success(let upload, _, _):
            print("Success!")
        case .Failure(let encodingError):
            print("Failure!")
        }
    }
)

where data is an UIImage which was encoded using YYImageEncoder like that:

let webpEncoder = YYImageEncoder(type: .WebP)
webpEncoder?.quality = 0.8
webpEncoder?.addImage(image, duration: 0)
let data = webpEncoder?.encode()

The server should save the uploaded image and it worked until now but if I use the YYImageEncoder to get the webp representation, it fails with 502 and the error is the following:

[Result]: FAILURE: Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 0." UserInfo={NSDebugDescription=Invalid value around character 0.}

Like I said before, it works well with UIImageJPEGRepresentation(image, 0.8) but not with YYImageEncoder.
What exactly does the encode() method return? Is it possible to do an Multipart upload with the YYImageEncoder data?

YYSpriteSheetImage has memory issues?

Hi, I use YYLabel to display text with emoji in a message app. In the text parser the the label, I returned a YYSpriteSheetImage (with is also a UIImage) attachment.

When the message shows, the memory uses grows even I don't do anything. And after 4 or 5 times of memory warning, the app crashes.

This problem should be reproduced easily when there are about 50 emojis showing at the same time, the memory grows fast.

Also, when I check this with the Allocation profiler, I saw a massive CG Raster Data memory not being deallocated.
Please help me about where I was doing wrong, I am despairing

YYAnimatedImageView 关于 loopcount

注意到 YYAnimatedImageView 定义了 loop count 并且 是 用 decoder 解析出 image 的 loop count 使用

    NSUInteger _curLoop; ///< current loop count (from 0)
    NSUInteger _totalLoop; ///< total loop count, 0 means infinity

可是 有时候希望强制 使用 无限循环 或者 循环 一次
建议 暴露 外部 接口 强制 循环次数

YYImageEncoder Bug

https://github.com/ibireme/YYImage/blob/master/YYImage/YYImageCoder.m#L2727

+(NSData *)encodeImageWithDecoder:(YYImageDecoder *)decoder type:(YYImageType)type quality:(CGFloat)quality {
if (!decoder || !decoder.frameCount == 0) return nil;
YYImageEncoder *encoder = [[YYImageEncoder alloc] initWithType:type];
encoder.quality = quality;
for (int i = 0; i < decoder.frameCount; i++) {
UIImage *frame = [decoder frameAtIndex:i decodeForDisplay:YES].image;
[encoder addImageWithData:UIImagePNGRepresentation(frame) duration:[decoder frameDurationAtIndex:i]];
}
return encoder.encode;
}

这里应该是 decoder.frameCount == 0 吧??

Crash app

dyld: Library not loaded: @rpath/YYImage.framework/YYImage
Referenced from: /private/var/containers/Bundle/Application/8E364E8F-678C-4570-A725-9FFF69F5E352/StickerBuilder.app/PlugIns/Builder.appex/Builder
Reason: image not found

I have link YYImage via pods, but extension is crashed on start.

animationRepeatCount 和 gif总帧数

您好:

需要咨询您两个问题
1.我在使用使用过程中发现animationRepeatCount不起作用了,有时候也许需要播放几次后就停止应该怎么做呢?
2.gif一共有多少帧怎么获取呢?animationImages 是NULL的

谢谢!

Why not cache images in YYFrameImage?

Imagine this scenario:
I have some imageViews that init with the same frame image( instance of YYFrameImage),and add them to some view simultaneously.Apparently,the more imageViews,the slower animations,because of high CPU usage to decode images.So is adding an array in YYFrameImage to cache the decoded images a correct way like the code below?

@implementation YYFrameImage {
    NSUInteger _loopCount;
    NSUInteger _oneFrameBytes;
    NSArray *_imagePaths;
    NSArray *_imageDatas;
    NSArray *_frameDurations;
    NSMutableArray *_decodedImages;  // to cache the decoded images
}

- (UIImage *)animatedImageFrameAtIndex:(NSUInteger)index {
    // suppose we init this array before
    if (index < _decodedImages.count) {
        return _decodedImages[index];
    }
    if (_imagePaths) {
        if (index >= _imagePaths.count) return nil;
        NSString *path = _imagePaths[index];
        CGFloat scale = _NSStringPathScale(path);
        NSData *data = [NSData dataWithContentsOfFile:path];
        UIImage *image = [[UIImage imageWithData:data scale:scale] yy_imageByDecoded];
        // cache decoded image
        [_decodedImages addObject:image];
        return image;
    } else if (_imageDatas) {
        if (index >= _imageDatas.count) return nil;
        NSData *data = _imageDatas[index];
        UIImage *image = [[UIImage imageWithData:data scale:[UIScreen mainScreen].scale] yy_imageByDecoded];
        // cache decoded image
        [_decodedImages addObject:image];
        return image;
    } else {
        return index == 0 ? self : nil;
    }
}

And we can also add some methods to handle the memory warning and background mode.

请问有把jpg/png转成webp格式的方法吗?

现在有个问题就是 上传图片过度压缩导致图片不清晰 不压缩又太大导致上传太慢 后来想到转webp格式之后上传但这个过程CPU飙好高 不知道YYImage能否解决这样的问题呢

请问 :webp.framework中45 duplicate symbols for architecture arm64怎么解决

/Classes/MSExpand/Vendor/YYImage/WebP.framework/WebP(libwebpdsp_la-yuv.o)
/Classes/MSExpand/Vendor/YYImage/WebP.framework/WebP(libwebpdspdecode_la-yuv.o)
duplicate symbol _WebPInitSamplers in:
/Classes/MSExpand/Vendor/YYImage/WebP.framework/WebP(libwebpdsp_la-yuv.o)
/Classes/MSExpand/Vendor/YYImage/WebP.framework/WebP(libwebpdspdecode_la-yuv.o)
duplicate symbol _WebPSamplerProcessPlane in:
/Classes/MSExpand/Vendor/YYImage/WebP.framework/WebP(libwebpdsp_la-yuv.o)
/Classes/MSExpand/Vendor/YYImage/WebP.framework/WebP(libwebpdspdecode_la-yuv.o)
ld: 45 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

合成webp异常

我在应用里用两帧图片合成的 webp,底下有一片色块。
使用的YYImage的版本是1.0.1

两张图片是一样的,只有贴纸在动,可能是编码成 webp 的问题,发上来请教一下。
不是必现的,目前只见到一例。

合成后的 Webp

拆成两帧后

some time times crashed when decode image.

please refer attach log

0 libsystem_platform.dylib 0x0000000180e1e2a0 _platform_memmove + 176
1 CoreGraphics 0x0000000182565244 CGBlt_copyBytes + 384
2 CoreGraphics 0x0000000182565244 CGBlt_copyBytes + 384
3 CoreGraphics 0x00000001826496e4 _argb32_image + 3504
4 CoreGraphics 0x00000001826d6e9c _ripl_Mark + 32
5 CoreGraphics 0x00000001826d3aa4 _RIPLayerBltImage + 972
6 CoreGraphics 0x0000000182632998 _ripc_DrawImage + 768
7 CoreGraphics 0x00000001826236c4 CGContextDrawImageWithOptions + 456
8 testApp 0x000000010031fda4 YYCGImageCreateDecodedCopy (YYImageCoder.m:890)
9 testApp 0x0000000100323230 -YYImageDecoder _newUnblendedImageAtIndex:extendToCanvas:decoded:
10 testApp 0x0000000100321a88 -YYImageDecoder _frameAtIndex:decodeForDisplay:
11 testApp 0x0000000100321670 -YYImageDecoder frameAtIndex:decodeForDisplay:
12 testApp 0x000000010031f0ac -YYImage initWithData:scale:
13 testApp 0x00000001001e2d1c __50-[YYWebImageOperation connectionDidFinishLoading:]_block_invoke (YYWebImageOperation.m:657)

关于动态图循环的疑问

默认无限循环的动态图可以正常的开始(startAnimating)和停止(stopAnimating);
假如动态图本身就是播放3次然后停止,停止后再startAnimating是没有作用的;
当然这不是YYImage的问题,YYImage还是很好用的,假如你知道关于这方面的问题的话,欢迎指教.

Orientation为右的UIImage编码错误

    NSData *data = [YYImageEncoder encodeImage:image type:YYImageTypeWebP quality:0.75];

用以上代码对一张 Orientation 为右的 UIImage 进行编码时,发现编码后得到图片是错误的,如下图。
img_0492

定位到是 YYImageCoder.m 下 YYCGImageCreateAffineTransformCopy 的问题。水平有限,这个地方看不懂,提上来请大神修复。

关于webp的转码问题

  由于我们项目中强制使用了FLAnimatedImage,所以我需要在下载图片完成以后,将图片转成NSData赋值给FLA在ImageView上显示出来。如下:

FLAnimatedImage *flImage = [FLAnimatedImage animatedImageWithGIFData:yyImage.animatedImageData];
self.animatedImage = flImage;
普通的gif这样操作完全没问题

这是我的图片地址: http://7xv1nd.com2.z0.glb.qiniucdn.com/942f4241967a4ec4a8567d6701c7a52f.gif?imageView2/2/h/375/w/750/format/webp

这是一张用七牛获取的webp 动图,我希望转成GIF的NSData复制给FLA,然而行不通,求大神解救

               YYImageDecoder *decoder=  [yyImage valueForKey:@"_decoder"];
                NSData *gifData=  [YYImageEncoder encodeImageWithDecoder:decoder type:YYImageTypeGIF quality:1.0];
                FLAnimatedImage *flImage = [FLAnimatedImage animatedImageWithGIFData:gifData];
                self.animatedImage = flImage;

Do not let Xcode compressed APNG files

In README, it may worth to note that for APNG we need to disable Compressing PNG in Xcode, which is enabled by default. It took me a couple of hours to figure out what's wrong.

YYImageCoder crash in iOS 10 beta3

We've encountered frequent crash while using YYWebImage in iOS 10 beta3.

Reproduce background:

  1. We have a UICollectionView to present lots of images(include jpeg and gif), and it is able to load more images in pages.
  2. All the presented images are loaded with URLs.
    Reproduce procedure:
    Just swipe the UICollectionView rapidly to load more images.

Here are two stack frame of crashed thread:

Stack Frame One:
// the relevant image is http://img04.sogoucdn.com/app/a/200678/146711412524012.gif

Thread 10 name: com.ibireme.webimage.request
Thread 10 Crashed:
0 vImage 0x0000000182b10dc0 0x182b07000 + 40384
1 vImage 0x0000000182b095a0 0x182b07000 + 9632
2 CoreGraphics 0x0000000182ea12e8 0x182e6e000 + 209640
3 CoreGraphics 0x00000001830816c4 0x182e6e000 + 2176708
4 CoreGraphics 0x000000018310d484 0x182e6e000 + 2749572
5 CoreGraphics 0x000000018310a094 0x182e6e000 + 2736276
6 CoreGraphics 0x000000018306ace4 0x182e6e000 + 2084068
7 CoreGraphics 0x000000018305ac74 0x182e6e000 + 2018420
8 MyApp 0x00000001003072e8 YYCGImageCreateDecodedCopy (YYImageCoder.m:890)
9 MyApp 0x000000010030a7f0 -YYImageDecoder _newUnblendedImageAtIndex:extendToCanvas:decoded:
10 MyApp 0x0000000100308fcc -YYImageDecoder _frameAtIndex:decodeForDisplay:
11 MyApp 0x0000000100308bb4 -YYImageDecoder frameAtIndex:decodeForDisplay:
12 MyApp 0x000000010031d6b8 -YYWebImageOperation connection:didReceiveData:
13 CFNetwork 0x00000001822e33e0 0x1820d5000 + 2155488
14 CFNetwork 0x00000001822e3370 0x1820d5000 + 2155376
15 CFNetwork 0x00000001822e34e4 0x1820d5000 + 2155748
16 CFNetwork 0x00000001822a2c5c 0x1820d5000 + 1891420
17 CFNetwork 0x000000018220b4c4 0x1820d5000 + 1270980
18 CFNetwork 0x000000018220a638 0x1820d5000 + 1267256
19 libdispatch.dylib 0x0000000181529784 0x181528000 + 6020
20 libdispatch.dylib 0x0000000181534f80 0x181528000 + 53120
21 CFNetwork 0x00000001822c154c 0x1820d5000 + 2016588
22 CoreFoundation 0x00000001819bb238 0x1819b3000 + 33336
23 CFNetwork 0x00000001822c1430 0x1820d5000 + 2016304
24 CFNetwork 0x00000001822c2758 0x1820d5000 + 2021208
25 CFNetwork 0x00000001822c24c4 0x1820d5000 + 2020548
26 CoreFoundation 0x0000000181a8e418 0x1819b3000 + 898072
27 CoreFoundation 0x0000000181a8dd60 0x1819b3000 + 896352
28 CoreFoundation 0x0000000181a8b960 0x1819b3000 + 887136
29 CoreFoundation 0x00000001819bb8d8 0x1819b3000 + 35032
30 Foundation 0x0000000182458e3c 0x18244c000 + 52796
31 Foundation 0x00000001824ad584 0x18244c000 + 398724
32 MyApp 0x000000010031b290 +YYWebImageOperation _networkThreadMain:
33 Foundation 0x00000001825553ac 0x18244c000 + 1086380
34 libsystem_pthread.dylib 0x00000001817339ec 0x181730000 + 14828
35 libsystem_pthread.dylib 0x00000001817338fc 0x181730000 + 14588
36 libsystem_pthread.dylib 0x0000000181730ef8 0x181730000 + 3832

Stack Frame Two:

<NSThread: 0x17447bc00>{number = 9, name = com.ibireme.webimage.request}
<_NSCallStackArray 0x1704493c0>(
0 ??? 0x000000010d048a74 0x0 + 4513368692,
1 MyApp 0x0000000100479d44 main + 0,
2 ImageIO 0x000000018379b174 + 32,
3 ImageIO 0x00000001838d2d1c + 1252,
4 ImageIO 0x00000001838d4fe4 + 88,
5 ImageIO 0x00000001836e0aec + 1084,
6 ImageIO 0x00000001836e1c38 + 68,
7 ImageIO 0x00000001836e1bb8 + 100,
8 ImageIO 0x00000001836e4764 CGImageSourceCopyPropertiesAtIndex + 188,
9 MyApp 0x000000010058cf04 -[YYImageDecoder _updateSourceImageIO] + 1320,
10 MyApp 0x000000010058b8a8 -[YYImageDecoder _updateSource] + 160,
11 MyApp 0x000000010058ac80 -[YYImageDecoder _updateData:final:] + 524,
12 MyApp 0x000000010058a6c4 -[YYImageDecoder updateData:final:] + 128,
13 MyApp 0x00000001005aff20 -[YYWebImageOperation connection:didReceiveData:] + 1284,
14 CFNetwork 0x00000001822e33e0 + 80,
15 CFNetwork 0x00000001822e3370 + 200,
16 CFNetwork 0x00000001822e34e4 + 56,
17 CFNetwork 0x00000001822a2c5c + 76,
18 CFNetwork 0x000000018220b4c4 + 272,
19 CFNetwork 0x000000018220a638 + 108,
20 libdispatch.dylib 0x0000000100e21954 _dispatch_client_callout + 16,
21 libdispatch.dylib 0x0000000100e2c26c _dispatch_block_invoke_direct + 400,
22 CFNetwork 0x00000001822c154c + 36,
23 CoreFoundation 0x00000001819bb238 CFArrayApplyFunction + 68,
24 CFNetwork 0x00000001822c1430 + 136,
25 CFNetwork 0x00000001822c2758 + 312,
26 CFNetwork 0x00000001822c24c4 + 64,
27 CoreFoundation 0x0000000181a8e418 + 24,
28 CoreFoundation 0x0000000181a8dd60 + 524,
29 CoreFoundation 0x0000000181a8b960 + 804,
30 CoreFoundation 0x00000001819bb8d8 CFRunLoopRunSpecific + 444,
31 Foundation 0x0000000182458e3c + 304,
32 Foundation 0x00000001824ad584 + 88,
33 MyApp 0x00000001005ac3f8 +[YYWebImageOperation _networkThreadMain:] + 308,
34 Foundation 0x00000001825553ac + 1024,
35 libsystem_pthread.dylib 0x00000001817339ec + 240,
36 libsystem_pthread.dylib 0x00000001817338fc + 0,
37 libsystem_pthread.dylib 0x0000000181730ef8 thread_start + 4
)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.