简体   繁体   中英

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?

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM