我正在使用(尝试)AlamofireImage。 我的保存到缓存图像并未真正保存。AlamofireImage保存到缓存图像并非真正保存
我的代码包括:
import Alamofire
import AlamofireImage
let imageCache = AutoPurgingImageCache(
memoryCapacity: 100 * 1024 * 1024,
preferredMemoryUsageAfterPurge: 60 * 1024 * 1024
)
然后我使用保存图像自己:
imageCache.add(image, withIdentifier: path)
但在接下来的运行,它总是返回零当我尝试使用,以获取该图像相同的路径:
if let image = imageCache.image(withIdentifier: path){
return image
}
return nil
我做错了什么?
- 而运行\调试我可以看到imageCache-currentMemoryUsage = 0
感谢。