1

最近アプリをアプリストアにリリースしたところ、すぐに SDWebImageManager imageDownloader:didFinishWithImage でいくつかのクラッシュが発生しました。スタックの上部は次のようになります。

0 libobjc.A.dylib 0x33c28c98 objc_msgSend + 16
1 CoreFoundation 0x308f0571 -[NSObject(NSObject) performSelector:withObject:withObject:] + 25
2 Ourcode 0x0001d98f -SDWebImageManager imageDownloader:didFinishWithImage:
3 CoreFoundation 0x308f0571 -[NSObject(NSObject) performSelector:withObject:withObject:] + 25
4 Ourcode 0x0001cb03 -SDWebImageDownloader connectionDidFinishLoading:

この関数内のデリゲートを保持する最新の SD コードがあります。デリゲートが適切に作成されている限り、どのようにしてこの状況に陥るのかわかりません。performSelector のデリゲートが解放されたようです。しかし、SDWebImageManager はデリゲートを保持します。

imageDownloader:didFinishWithImage: に関連するコードは次のとおりです。

- (void)imageDownloader:(SDWebImageDownloader *)downloader didFinishWithImage:(UIImage *)image
{
    [downloader retain];
    SDWebImageOptions options = [[downloader.userInfo objectForKey:@"options"] intValue];

     // Notify all the downloadDelegates with this downloader
    for (NSInteger idx = (NSInteger)[downloaders count] - 1; idx >= 0; idx--)
    {
        NSUInteger uidx = (NSUInteger)idx;
        SDWebImageDownloader *aDownloader = [downloaders objectAtIndex:uidx];
        if (aDownloader == downloader)
        {
            id<SDWebImageManagerDelegate> delegate = [[[downloadDelegates objectAtIndex:uidx] retain] autorelease];

            if (image)
            {
                if ([delegate respondsToSelector:@selector(webImageManager:didFinishWithImage:)])
                {
                    [delegate performSelector:@selector(webImageManager:didFinishWithImage:) withObject:self withObject:image];
               }
           }
4

0 に答える 0