summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLOfflineStorage.mm
diff options
context:
space:
mode:
authorJason Wray <friedbunny@users.noreply.github.com>2016-05-24 22:00:52 -0400
committerJason Wray <friedbunny@users.noreply.github.com>2016-05-24 22:00:52 -0400
commit9c9140595e9c1d9a12120e167421034f6036b08a (patch)
treee7d5d61550693f445ad06946f59367886de13e15 /platform/darwin/src/MGLOfflineStorage.mm
parent68e84b14a203e348710da550cb198bf878068e19 (diff)
downloadqtlocation-mapboxgl-9c9140595e9c1d9a12120e167421034f6036b08a.tar.gz
[ios] Set backup exclusion flag after initializing DefaultFileSource (#5124)
Speculatively fixes #511, where apps mistakenly backup the offline/ambient cache.
Diffstat (limited to 'platform/darwin/src/MGLOfflineStorage.mm')
-rw-r--r--platform/darwin/src/MGLOfflineStorage.mm14
1 files changed, 7 insertions, 7 deletions
diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm
index f09b03def1..a59fb69943 100644
--- a/platform/darwin/src/MGLOfflineStorage.mm
+++ b/platform/darwin/src/MGLOfflineStorage.mm
@@ -64,12 +64,6 @@ NSString * const MGLOfflinePackMaximumCountUserInfoKey = @"MaximumCount";
NSURL *cacheURL = [cacheDirectoryURL URLByAppendingPathComponent:MGLOfflineStorageFileName];
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.
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
@@ -92,7 +86,13 @@ NSString * const MGLOfflinePackMaximumCountUserInfoKey = @"MaximumCount";
}
_mbglFileSource = new mbgl::DefaultFileSource(cachePath.UTF8String, [NSBundle mainBundle].resourceURL.path.UTF8String);
-
+
+ // 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];
+
// Observe for changes to the global access token (and find out the current one).
[[MGLAccountManager sharedManager] addObserver:self
forKeyPath:@"accessToken"