在后台下载图像

时间:2018-10-11 11:26:34

标签: ios swift sdwebimage

我需要下载大尺寸的图像。即使我的应用程序进入后台,下载也需要继续。我正在使用SD-Web图像框架处理图像下载。它工作正常,但是当应用程序从后台运行到前台时,图像下载将终止。

这是我的代码:

let completionblock : SDExternalCompletionBlock = { image, error, cacheType, 
imageURL in
        activityIndicator.stopAnimating()
        activityIndicator.removeFromSuperview()
    }

  imageThumbnail.sd_setImage(with: imagUrl, completed: completionblock)`

1 个答案:

答案 0 :(得分:0)

下载完成后,UIImageView将调用mainThread。 视图更新了mainThread上的需求。因此,您需要更新线程。

find . -name "enum.py"

主要