summaryrefslogtreecommitdiff
path: root/ios
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2015-05-20 14:38:36 -0700
committerMinh Nguyễn <mxn@1ec5.org>2015-05-20 14:38:36 -0700
commit256b748458571201fe2b64bdf84dae6ec9b5932e (patch)
tree850d298f43f52db5e7e59eaabcb78a5d71237d0b /ios
parent8f8631963b66a0442e6b5fbc920a58d72e7ae1d7 (diff)
parent90a50c0c4150080f725cc6b66909eef58a2a9b4a (diff)
downloadqtlocation-mapboxgl-256b748458571201fe2b64bdf84dae6ec9b5932e.tar.gz
Merge branch '1ec5-plist-1535'
Diffstat (limited to 'ios')
-rw-r--r--ios/app/MBXAppDelegate.m32
1 files changed, 15 insertions, 17 deletions
diff --git a/ios/app/MBXAppDelegate.m b/ios/app/MBXAppDelegate.m
index dc04105083..b09235a278 100644
--- a/ios/app/MBXAppDelegate.m
+++ b/ios/app/MBXAppDelegate.m
@@ -6,24 +6,22 @@
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
- // Set Access Token
- NSString *accessToken = [[NSProcessInfo processInfo] environment][@"MAPBOX_ACCESS_TOKEN"];
- if (accessToken) {
- // Store to preferences so that we can launch the app later on without having to specify
- // token.
- [[NSUserDefaults standardUserDefaults] setObject:accessToken forKey:@"access_token"];
- } else {
- // Try to retrieve from preferences, maybe we've stored them there previously and can reuse
- // the token.
- accessToken = [[NSUserDefaults standardUserDefaults] objectForKey:@"access_token"];
- }
- if ( ! accessToken) NSLog(@"No access token set. Mapbox vector tiles won't work.");
-
- // Signal To SDK That Opt Out Is In App UI
-// [MGLAccountManager setMapboxMetricsEnabledSettingShownInApp:YES];
+ // Set access token, unless MGLAccountManager already read it in from Info.plist.
+ if ( ! [MGLAccountManager accessToken]) {
+ NSString *accessToken = [[NSProcessInfo processInfo] environment][@"MAPBOX_ACCESS_TOKEN"];
+ if (accessToken) {
+ // Store to preferences so that we can launch the app later on without having to specify
+ // token.
+ [[NSUserDefaults standardUserDefaults] setObject:accessToken forKey:@"access_token"];
+ } else {
+ // Try to retrieve from preferences, maybe we've stored them there previously and can reuse
+ // the token.
+ accessToken = [[NSUserDefaults standardUserDefaults] objectForKey:@"access_token"];
+ }
+ if ( ! accessToken) NSLog(@"No access token set. Mapbox vector tiles won't work.");
- // Start Mapbox GL SDK
- [MGLAccountManager setAccessToken:accessToken];
+ [MGLAccountManager setAccessToken:accessToken];
+ }
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[MBXViewController new]];