From 635aebbb89d205a52806ebfa18214d3a649c7291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Mon, 28 Mar 2016 12:27:20 -0700 Subject: [PATCH] [ios, osx] Exclude offline cache from backups MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoid backing up the offline cache onto iCloud, because it can be redownloaded and would easily take up a significant portion of a standard iCloud account. Ideally, we’d even put ambiently cached resources in Caches, so it can be reclaimed by the system when disk space runs low. But unfortunately it has to live in the same file as offline resources. --- platform/darwin/src/MGLOfflineStorage.mm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm index 1f925b3ee..4dbfb0580 100644 --- a/platform/darwin/src/MGLOfflineStorage.mm +++ b/platform/darwin/src/MGLOfflineStorage.mm @@ -49,6 +49,12 @@ NSURL *cacheURL = [cacheDirectoryURL URLByAppendingPathComponent:fileName]; NSString *cachePath = cacheURL ? cacheURL.path : @""; + // Avoid backing up the offline cache onto iCloud, because it can be + // redownloaded. Ideally, we’d even put the ambient cache in Caches, so + // it can be reclaimed by the system when disk space runs low. But + // unfortunately it has to live in the same file as offline resources. + [cacheURL setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:NULL]; + // Move the offline cache from v3.2.0-beta.1 to a location that can also // be used for ambient caching. NSString *legacyCacheFileName = @"offline.db";