Ios PINRemoteImage删除缓存
我正在iOS应用程序中使用PINRemoteImage在UIImageView上设置图像。我总是有相同的图像链接,但在此期间图像可以更改(我可以上载不同的图像),但每当我在UIImageView上调用pin_setImageFromURL时,它总是设置一个旧图像(如果我删除应用并重新安装它,则不会)。我发现调用[[[PINRemoteImageManager sharedImageManager]defaultImageCache]removeAllObjects]将从缓存中删除图像,但只有在我关闭并重新打开应用程序时才会删除,所以有人知道如何在调用upper方法后立即强制应用程序更新缓存吗?我发现了此方法来清除缓存:Ios PINRemoteImage删除缓存,ios,objective-c,caching,uiimageview,Ios,Objective C,Caching,Uiimageview,我正在iOS应用程序中使用PINRemoteImage在UIImageView上设置图像。我总是有相同的图像链接,但在此期间图像可以更改(我可以上载不同的图像),但每当我在UIImageView上调用pin_setImageFromURL时,它总是设置一个旧图像(如果我删除应用并重新安装它,则不会)。我发现调用[[[PINRemoteImageManager sharedImageManager]defaultImageCache]removeAllObjects]将从缓存中删除图像,但只有在我
[[[PINRemoteImageManager sharedImageManager] cache] removeObjectForKey:
[[PINRemoteImageManager sharedImageManager]cacheKeyForURL:your_URL processorKey:nil]];
因此,在-(void)视图中将出现:(BOOL)animated
中,您可以使用您的URL再次设置ImageView
这在我这边起了作用;) Swift中从缓存中删除图像的简单解决方案是:
import PINRemoteImage
import PINCache
if let cacheKey = PINRemoteImageManager.sharedImageManager().cacheKeyForURL(NSURL(string: "http://your-image-url"), processorKey: nil) {
PINRemoteImageManager.sharedImageManager().cache.removeObjectForKey(cacheKey, block: nil)
}
这似乎是在使用纹理+ASNetworkImageNode时清除PINCache的方法。