When iOS application is opened from some URL AppDelegates's
methods are called in such a sequence:
1. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
2. - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
How to know in didFinishLaunchingWithOptions
method if application was opened from URL or not. May be there are some launching options which I miss?
You can inspect launchOptions
passed to - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
.
Look for section Launch Options Keys
in reference docs, specifically UIApplicationLaunchOptionsURLKey
If your app has been launch from a URL You will find a
UIApplicationLaunchOptionsURLKey
in the launchOptions
Dictionary of - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
On a related note the handleOpenURL:
method is deprecated, you should use:
-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With