I have integrated the Firebase DeepLink/DynamicLinks/UniversalLink
into our app. When the app is running
or in background/foreground state
, Deep Links
works with no problem. However, when the app is not running
or in killed/terminated
state the app will launch, but no trigger method will be called or initialize. It's like it only triggers the URL Scheme
. So, as a result, I am not able to get the data on the deep links that were clicked, and that was the big problem.
In didFinishLaunchingWithOptions:
launchOptions
is always nil, and therefore launchOptions[.url]
is nil
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
And open url:options:
does not trigger
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool
And ofcourse this one continue userActivity:restorationHandler:
does not trigger
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool
So, I was only able to launch the app with no data captured. Any workaround or suggestion is appreciated. Thanks!
Took me sometime to resolve this issue. After trying a bunch of workaround, the solution that worked was to migrate to the new
Apple's App Structure
usingSceneDelegate
.To handle DeepLink from terminated state, you need to configure this function:
To handle the other part of the scene delegate which are UIApplication equivalent:
If you plan to do the migration, make sure to properly configure your
Info.plist
'sApplication Scene Manifest
then set your scene configuration here:Your
Application Scene Manifest
should look something like this: