Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase dynamic links are not working on iOS when the dynamic link has the custom subdomain

I have integrated firebase dynamic links in my app as per the guidelines mentioned in source1, source2. Everything is working as expected on the app for the default domains.

But when I create a custom subdomain on firebase console and use it on the iOS device it's not working as expected(Even when the app is installed). I have added the new subdomain like applinks:example.page.link on Capabilities=>Associated Domains on my Xcode project.

Below is the straight scenario:

1) App is installed on the device.

2) Tapped on the dynamic link(with custom subdomain) https://example.page.link/abcXYZ on email.

3) It directly opened the app and linkHandled on my following code is always false and completion from handleUniversalLink function is never called.

func application(_ application: UIApplication,
                   continue userActivity: NSUserActivity,
                   restorationHandler: @escaping ([Any]?) -> Void) -> Bool {

    if let incomingURL = userActivity.webpageURL {
      let linkHandled = FIRDynamicLinks.dynamicLinks()?.handleUniversalLink(incomingURL, completion: { (dynamiclink, error) in
        if let dynamiclink = dynamiclink, let _ =  dynamiclink.url {
          self.handleIncomingDynamicLink(dynamiclink: dynamiclink)
        }
      })

      return linkHandled
    }

    return false
  }

But for the default domains created by firebase like https://my328.app.goo.gl/abcXYZ are working fine, linkHandled is always true, completion from handleUniversalLink is called and I'm receiving the expected Deep link(which is configured on firebase console) on completion.

Any thoughts on why Firebase dynamic links are not working on the app for custom subdomains? Do I need to configure anything additional than mentioned on the link for custom subdomains?

like image 988
Ashok Avatar asked Jun 20 '18 15:06

Ashok


People also ask

How do I set up Dynamic Links in Firebase for iOS?

In the Firebase console, open the Dynamic Links section. Accept the terms of service if you are prompted to do so. Ensure that your app's App Store ID and your App ID prefix is specified in your app's settings. To view and edit your app's settings, go to your Firebase project's Settings page and select your iOS app.

How do I create a custom subdomain for my Firebase project?

Create your free subdomain in the Firebase console. All Dynamic Links features, including analytics, post-install attributions, and SDK integrations, work with both custom page.link domains and your own domain. Enable Firebase Dynamic Links for your Firebase project in the Firebase console.

What if I don't have a domain for my Firebase app?

Or, if you don't have a domain for your app, you can use a free custom page.link subdomain: Create your free subdomain in the Firebase console. All Dynamic Links features, including analytics, post-install attributions, and SDK integrations, work with both custom page.link domains and your own domain.

How do I enable dynamic links in my iOS app?

To view and edit your app's settings, go to your Firebase project's Settings page and select your iOS app. You can confirm that your Firebase project is properly configured to use Dynamic Links in your iOS app by opening the following URL:


2 Answers

If custom domain not working and Google domain working then you need to add FirebaseDynamicLinksCustomDomains key to the info.plist for iOS

<key>FirebaseDynamicLinksCustomDomains</key>
<array>
  <string>https://custom-domain.com</string>
</array>

Ref: https://firebase.google.com/docs/dynamic-links/custom-domains

like image 99
Darshit Mendapara Avatar answered Oct 04 '22 05:10

Darshit Mendapara


It's because I was using FirebaseDynamicLinks 1.4.0 which is old. When I update to FDL library 3.0.1, dynamic links with custom subdomain are working fine in the app.

The reason why I believed that I was using the latest FDL library and couldn't identify that I was using old FDL library is, CocoaPods(a dependency manager for iOS projects, read more) couldn't get me the latest version of FirebaseDynamicLinks for some reason, no matter what I do like remove and reinstall FirebaseDynamicLinks from Pod file or run pod update command. So, I have removed FirebaseDynamicLinks from pod file and ran the command pod install, it removed that library from my project and now I have downloaded FirebaseDynamicLinks framework from firebase console and integrated it manually on my project. Now with the new FirebaseDynamicLinks SDK, dynamic links with custom subdomain are working fine in the app.

like image 24
Ashok Avatar answered Oct 04 '22 06:10

Ashok