Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SDWebImage crash in swift

it seems if I use "self" in the completed block, it will crash.

self.imageView.sd_setImageWithURL(MYIMAGEURL
            , placeholderImage: nil
            , options: SDWebImageOptions.RetryFailed
            , progress: {(receivedSize: Int!, expectedSize: Int!) in

            }
            , completed:{(image: UIImage?, error: NSError?, cacheType: SDImageCacheType!, imageURL: NSURL?) in
                if image {
                    UIView.transitionWithView(self.imageView
                        , duration: 0.3
                        , options: UIViewAnimationOptions.AllowUserInteraction | UIViewAnimationOptions.TransitionCrossDissolve
                        , animations: {

                        }
                        , completion: {(finished) in

                        })
                }
            })
like image 237
ZYiOS Avatar asked Dec 31 '25 08:12

ZYiOS


1 Answers

The SDWebImageModule is an actively developed open source component. It is much better in this case to raise a bug on GitHub. The developers have already made a few releases that fix Xcode6 and Swift issues.

like image 162
ColinE Avatar answered Jan 03 '26 03:01

ColinE



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!