我正在使用Kingfisher框架预取图像但是加班我在completedResources中什么都没得到。它始终打印“这些资源是预取的:[]”我首先获取albumImagePathArray中的URL数量,这些URL被成功获取但是当我调用downloadImages()方法时,它显示“这些资源是预取的:[]”。 Kingfisher框架的链接是:https://github.com/onevcat/Kingfisher
这是我写的代码:
func downloadImages() {
if(self.albumImagePathArray.isEmpty == false) {
//dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), {
let urls = self.albumImagePathArray.map { NSURL(string: $0)! }
let prefetcher = ImagePrefetcher(urls: urls, optionsInfo: nil, progressBlock: nil, completionHandler: {
(skippedResources, failedResources, completedResources) -> () in
print("These resources are prefetched: \(completedResources)")
})
prefetcher.start()
}
}