5

I tried to create dynamicLink at Firebase console to navigate user to download my app at appStore, and when they launch app for the first time I keep getting DynamicLink object with nil url.

 func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {

      if let dynamicLink = DynamicLinks.dynamicLinks().dynamicLink(fromCustomSchemeURL: url) {
            //  dynamicLink url is nil 
      }
}
<FIRDynamicLink: 0x281ad2a40, url [(null)], match type: none, minimumAppVersion: N/A, match message: (null)>

and the url is

MyAppSchema://google/link/?dismiss=1&is_weak_match=1

when I perform diagnostic i got this


---- Firebase Dynamic Links diagnostic output start ----
Firebase Dynamic Links framework version 3.0.1
System information: OS iOS, OS version 12.1.4, model iPhone
Current date 2019-03-28 10:10:21 +0000
Device locale en-US (raw en_US), timezone Asia/Taipei
    Specified custom URL scheme is {MyAppSchema} and Info.plist contains such scheme in CFBundleURLTypes key.
    AppID Prefix: {AppID Prefix}, Team ID: {teamID}, AppId Prefix equal to Team ID: YES
performDiagnostic completed successfully! No errors found.
---- Firebase Dynamic Links diagnostic output end ----

has tried / confirmed :

  1. not using safari private mode
  2. short link / long link
  3. app not installed
  4. switch preferredLanguages / region / locale
  5. preview page enabled
  6. wifi and Cellular

I opened an issue at Firebase iOS SDK repo

https://github.com/firebase/firebase-ios-sdk/issues/2666

Steps to reproduce:

  1. app not installed
  2. click on a dynamicLink
  3. preview page
  4. appStore page
  5. build to device from Xcode
  6. get DynamicLink object but url is nil

expect step 6 to get url

KENdi
  • 7,576
  • 2
  • 16
  • 31
Ian
  • 239
  • 1
  • 14

4 Answers4

1

So I have been struggling for quite a while now, and also in the current situation you are in, all the steps have been followed similar to the documentation and debug shows it as having no errors.

I finally figured it out tonight, or should I say 14 mins into the new year 2020! All I needed was to enable dynamic links in the google api console. Why was this not documented at all.

Heres the link! https://console.developers.google.com/apis/api/firebasedynamiclinks.googleapis.com/overview

RiceAndBytes
  • 1,286
  • 10
  • 21
1

I think you could try this:

Missing FirebaseDynamicLinkCustomDomains causing this problem, you should update this to your ios project: For example, if your url is: targetEncodedLink = https://yourtargetlink.com (you should encode it to this https%3A%2F%2Fyourtargetlink.com)

dynamicLink = https://yourfirebasedynamiclink.com/link/?link=${encodedLink}&apn=com.example&isi=1449448875&ibi=com.example

You should add this key to your ios project

// Info.plist
<dict////>
  <key>FirebaseDynamicLinksCustomDomains</key>
  <array>
    <string>https://yourtargetlink.com</string>
    <string>https://yourfirebasedynamiclink.com/link</string>
  </array>
</dict>

From this instruction: https://firebase.google.com/docs/dynamic-links/custom-domains

Hiep Tran
  • 3,735
  • 1
  • 21
  • 29
0

Try to update Firebase/DynamicLinks. I'd had the same issue and run pod update Firebase/DynamicLinks. Now Firebase/DynamicLinks is 6.21.0 and DynamicLink object has url value.

Lana
  • 11
  • 1
0

pod update Firebase if you're on iOS 13

Han
  • 74
  • 1
  • 10