private static void CheckBundleVersion() { // Drop a version nugget and clear the disk cache if one didn't previously exist, or it's not the same var version = AppGlobal.BundleVersion; string appdir = NSBundle.MainBundle.BundleUrl.Path; string cache = Path.GetFullPath(Path.Combine(appdir, "..", "Library", "Caches")); var versionPath = Path.Combine(cache, "v.txt"); var dumpDiskCache = false; if (!File.Exists(versionPath)) { dumpDiskCache = true; File.WriteAllText(versionPath, version); } else { var versionOnDisk = File.ReadAllText(versionPath); if (!version.Equals(versionOnDisk)) { dumpDiskCache = true; File.WriteAllText(versionPath, version); } } if (dumpDiskCache) { ImageCache.Clear(); ImageCache.DumpDiskCache(); } }
public override void ReceiveMemoryWarning(UIApplication application) { ImageCache.Clear(); }