我需要下载大尺寸的图像。即使我的应用程序进入后台,下载也需要继续。我正在使用 SD-Web Image 框架来处理图像下载。它工作正常,但是当应用程序从后台转到前台时,图像的下载会终止。
这是我的代码:
let completionblock : SDExternalCompletionBlock = { image, error, cacheType,
imageURL in
activityIndicator.stopAnimating()
activityIndicator.removeFromSuperview()
}
imageThumbnail.sd_setImage(with: imagUrl, completed: completionblock)`
最佳答案
下载完成后,UIImageView将调用mainThread。 主线程上的 View 更新需要。做,你需要更新线程。
activityIndicator.stopAnimating()
activityIndicator.removeFromSuperview()
在主页面
关于ios - 在后台下载图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52758899/