Firebase Dynamic Link Not Opening the App iOS

Firebase Dynamic links - when clicked not working in iOS

Finally I am able to resolve the issue.
The initial step is to create a universal link in Firebase console.
Once the universal link is created , we have to do following changes in XCode:

  1. Enable associated domains under capablities
  2. Include URL types
  3. Must verify your Team ID that you would have provided in firebase console.

Once the universal link setup is completed in Xcode, we can do build and run and check the working of Universal link.

i.e. clicking the link should open the app (provided app is already installed).
and it should not open the safari browser.

If clicking the link opens safari browser , then there is a problem with the Universal link setup.

The below tutorial is very useful:

https://youtu.be/KLBjAg6HvG0

Firebase dynamic link won't open Appstore when the app is not installed

Actually, turns out on the code inside the app to generate the dynamic link does not have the playstore app id supplied, which explains why it only broken when opening playstore but it's okay when opening appstore.

Firebase short dynamic link not working in iOS (being treated as a deeplink)

It turns out I needed to install a Capacitor Dynamic Links package for the short links to work in iOS.
https://www.npmjs.com/package/@pantrist/capacitor-firebase-dynamic-links

All I need to was install it and add the following function and it worked fine:

   FirebaseDynamicLinks.addListener('deepLinkOpen', (data) => {
console.log(data);
});

Before I was doing it like this:

   import { App, URLOpenListenerEvent } from '@capacitor/app';

App.addListener('appUrlOpen', (data: any) => {
console.log(data)
});

Note:
The dynamic link only works from the app store (no app installed) if the dynamic link has the preview set to on.

Firebase dynamic link not opening iOS app

Steps:

  1. Delete your app
  2. Restart your device.
  3. Reinstall your app and test.

As per firebase, sometimes error comes while downloading "apple-app-site-association" file associated with your domain. That's why it happens.

Check out this video: https://youtu.be/KLBjAg6HvG0?t=483 for debugging help.

Setup Dynaminc link from start: https://www.youtube.com/watch?v=KLBjAg6HvG0

If you have completed the above-mentioned steps, please check if you have the right methods implemented in your AppDelegate file.

Method 1:

    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
if DynamicLinks.dynamicLinks().shouldHandleDynamicLink(fromCustomSchemeURL: url) {
let dynamicLink = DynamicLinks.dynamicLinks().dynamicLink(fromCustomSchemeURL: url)
self.handleDynamicLink(dynamicLink)
return true
}

return true
}

Method 2:

    func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
if let incomingURL = userActivity.webpageURL {
print(incomingURL)

let linkHandled = DynamicLinks.dynamicLinks().handleUniversalLink(incomingURL) { (dynamicLink, error) in
guard error == nil else {
print("Found an error! \(error!.localizedDescription)")
return
}

if let dynamicLink = dynamicLink {
self.handleDynamicLink(dynamicLink)
}
}

if linkHandled {
return true
} else {
//May be do other things with our incoming URL?
return false
}
}

return false
}

Handle Dynamic Link common Method:

    func handleDynamicLink(_ dynamicLink: DynamicLink?) {
guard let dynamicLink = dynamicLink else { return }
guard let deepLink = dynamicLink.url else { return }

}


Related Topics



Leave a reply



Submit