diff options
author | Brad Leege <bleege@gmail.com> | 2015-03-24 10:37:59 -0500 |
---|---|---|
committer | Brad Leege <bleege@gmail.com> | 2015-03-24 10:37:59 -0500 |
commit | 5acf518ea6c7fe1c52e63922619ede5ba3f2404f (patch) | |
tree | 3d32e161e38424c7de01d99b3b107faf6faf0185 /platform | |
parent | 81f6c5cab28e62900b1e291dd3ae0094cc70c105 (diff) | |
download | qtlocation-mapboxgl-5acf518ea6c7fe1c52e63922619ede5ba3f2404f.tar.gz |
#1033 - Adding blank Settings.bundle infrastructure and ensuring it's loaded into memory
Diffstat (limited to 'platform')
-rw-r--r-- | platform/ios/MGLMapboxEvents.m | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m index 52a6f464c7..3178a460d4 100644 --- a/platform/ios/MGLMapboxEvents.m +++ b/platform/ios/MGLMapboxEvents.m @@ -40,6 +40,24 @@ NSNumber *scale; self = [super init]; if (self) { + // Put Settings bundle into memory + NSString *settingsBundle = [[NSBundle mainBundle] pathForResource:@"Settings" ofType:@"bundle"]; + if(!settingsBundle) { + NSLog(@"Could not find Settings.bundle"); + } else { + NSDictionary *settings = [NSDictionary dictionaryWithContentsOfFile:[settingsBundle stringByAppendingPathComponent:@"Root.plist"]]; + NSArray *preferences = [settings objectForKey:@"PreferenceSpecifiers"]; + NSMutableDictionary *defaultsToRegister = [[NSMutableDictionary alloc] initWithCapacity:[preferences count]]; + for(NSDictionary *prefSpecification in preferences) { + NSString *key = [prefSpecification objectForKey:@"Key"]; + if(key && [[prefSpecification allKeys] containsObject:@"DefaultValue"]) { + [defaultsToRegister setObject:[prefSpecification objectForKey:@"DefaultValue"] forKey:key]; + } + } + + [[NSUserDefaults standardUserDefaults] registerDefaults:defaultsToRegister]; + } + // Configure Events Infrastructure _queue = [[NSMutableArray alloc] init]; _flushAt = 20; |