[ios] Correctly handle return value for application:didFinishLaunchingWithOptions:

@TODO: Should we return immediately and do nothing if we have an url but can’t handle it?
This commit is contained in:
Alex Zolotarev 2015-09-08 12:08:35 -07:00
parent c3ab639c71
commit 2c2cf65a0c
3 changed files with 13 additions and 10 deletions

View file

@ -156,12 +156,15 @@ void InitLocalizedStrings()
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Initialize all 3party engines.
[[Statistics instance] application:application didFinishLaunchingWithOptions:launchOptions];
BOOL returnValue = [[Statistics instance] application:application
didFinishLaunchingWithOptions:launchOptions];
NSURL * urlUsedToLaunchMaps = launchOptions[UIApplicationLaunchOptionsURLKey];
if (urlUsedToLaunchMaps != nil)
returnValue |= [self checkLaunchURL:urlUsedToLaunchMaps];
else
returnValue = YES;
NSURL * url = launchOptions[UIApplicationLaunchOptionsURLKey];
if (url != nil)
[self checkLaunchURL:url];
[HttpThread setDownloadIndicatorProtocol:[MapsAppDelegate theApp]];
[self trackWatchUser];
@ -215,7 +218,7 @@ void InitLocalizedStrings()
application.applicationIconBadgeNumber = f.GetCountryTree().GetActiveMapLayout().GetOutOfDateCount();
f.GetLocationState()->InvalidatePosition();
return YES;
return returnValue;
}
- (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler

View file

@ -6,7 +6,7 @@
- (void)disableOnNextAppLaunch;
// Should be called from the same method in AppDelegate.
- (void)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;
// Should be called from the same method in AppDelegate.
- (void)applicationDidBecomeActive;
- (void)logEvent:(NSString *)eventName;

View file

@ -70,15 +70,13 @@ char const * kStatisticsEnabledSettingsKey = "StatisticsEnabled";
[Alohalytics logEvent:@"statisticsDisabled"];
}
- (void)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// _enabled should be already correctly set up in init method.
if (_enabled)
{
[Flurry startSession:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"FlurryKey"]];
[[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
[MRMyTracker createTracker:@"***REMOVED***"];
#ifdef DEBUG
[MRMyTracker setDebugMode:YES];
@ -88,6 +86,8 @@ char const * kStatisticsEnabledSettingsKey = "StatisticsEnabled";
[Alohalytics setup:@"http://localhost:8080" withLaunchOptions:launchOptions];
}
// Always call Facebook method, looks like it is required to handle some url schemes and sign on scenarios.
return [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
}
- (void)logLocation:(CLLocation *)location