Firebase dynamic deep link arrives nil after install
Asked Answered
B

5

7

I am attempting to use Firebase to pass deep links into my app that survive install.

To test this I am following the steps provided by the Firebase documentation and Firecast video here at about the 12min 40s mark. The steps are as follows:

  1. First I delete the app from my device.
  2. Then I press the link to open the app store.
  3. Then I run my app from xcode.
  4. Expected: The dynamicLink.url property will be equal to "https: //www.example.com/data/helloworld" in application:openURL
  5. Reality: The dynamicLink.url property arrives nil.

This is the deeplink url that I created in the Firebase console: https://nqze6app.goo.gl/RIl8

This is the url that is passed into application:openURL prior to being passed into dynamicLinkFromCustomSchemeURL : com.johnbogil.voices://google/link/dismiss?fdl_cookie

This is the code in my openURL call:

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options { 
  FIRDynamicLink *dynamicLink = [[FIRDynamicLinks dynamicLinks] dynamicLinkFromCustomSchemeURL:url];
  if (dynamicLink) { 
    NSLog(@"I am handling a link through the openURL method"); 
    [self handleDynamicLink:dynamicLink]; 
    return YES; 
  } else { 
    return NO; 
  } 
}

Not sure why dynamicLink.url is arriving nil. Any assistance is appreciated.

Boxer answered 23/8, 2016 at 17:51 Comment(5)
Can you also share... 1. The content of your application:openURL call? and 2. The fully expanded dynamic link? (In the Firebase control panel, click on "Link details" in the overflow menu and you should see it below.)Credible
@ToddKerpelman 1) ` - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options { FIRDynamicLink *dynamicLink = [[FIRDynamicLinks dynamicLinks]dynamicLinkFromCustomSchemeURL:url]; if (dynamicLink) { NSLog(@"I am handling a link through the openURL method"); [self handleDynamicLink:dynamicLink]; return YES; } else { return NO; } }` 2) nqze6.app.goo.gl/?link=https://www.example.com/data/… Targeting and testing for iOS 9.3Boxer
Okay. So can you confirm that you're seeing the "I am handling a link through the openURL method" link in your console output? Also... is there a chance you have Safari in "Private" mode?Credible
@ToddKerpelman I was using Safari in private mode. Leaving private mode solved the issue :)Boxer
Woo hoo! I went ahead and posted this as the official answer.Credible
C
4

For anybody who else who's encountering this same error...

  1. If your application:openURL method is getting called, and
  2. You do seem to be getting a valid dynamicLink object from your dynamicLinkFromCustomSchemeURL method, but
  3. The url parameter of that dynamicLink object is nil

Then double-check to see if you're in "Private" mode in Safari. That will kinda mess with Firebase Dynamic Links' ability to retrieve the original link that you clicked on.

Credible answered 26/8, 2016 at 1:4 Comment(2)
I tried all but am still getting FIRDynamicLink and error both as nilInurbane
can you help with this too: https://mcmap.net/q/1017712/-why-full-long-dynamic-link-is-not-getting-retrieved-received/6144372Raddi
O
7

I had the same issue. I was getting callback of restorationHandler but in handleUniversalLink callback dynamiclink and error both were nil. After spending some time I found my issue.

Turns out, url is case sensitive. For example if your url is:

https://xzz6b.app.goo.gl/0EWv

and you wrote https://xzz6b.app.goo.gl/0ewv in notes and clicked it. It will load your app and even give you callback of restorationHandler but dynamiclink will be nil.

You can try it even in browser.

Hope it helps anybody.

Ohg answered 1/3, 2017 at 8:14 Comment(1)
yeah. Also an extra character in the end will give same effect, like xzz6b.app.goo.gl/0EWv'Lignin
C
4

For anybody who else who's encountering this same error...

  1. If your application:openURL method is getting called, and
  2. You do seem to be getting a valid dynamicLink object from your dynamicLinkFromCustomSchemeURL method, but
  3. The url parameter of that dynamicLink object is nil

Then double-check to see if you're in "Private" mode in Safari. That will kinda mess with Firebase Dynamic Links' ability to retrieve the original link that you clicked on.

Credible answered 26/8, 2016 at 1:4 Comment(2)
I tried all but am still getting FIRDynamicLink and error both as nilInurbane
can you help with this too: https://mcmap.net/q/1017712/-why-full-long-dynamic-link-is-not-getting-retrieved-received/6144372Raddi
A
1

In my case this was due to the fact that I was using custom domains and I missed the bit in the docs (see point #3) that explicitly states that you need to list your Dynamic Links URL prefixes using a key called FirebaseDynamicLinksCustomDomains in your Info.plist file.

Anywhere answered 29/7, 2021 at 3:18 Comment(0)
P
0

I've faced the same problem.

Solution:

From docs

If the Dynamic Link isn't found on your app's first launch (on any version of iOS), this method will be called with the FIRDynamicLink's url set to nil, indicating that the SDK failed to find a matching pending Dynamic Link.

So you have to check this step

In the Info tab of your app's Xcode project, create a new URL type to be used for Dynamic Links. Set the Identifier field to a unique value and the URL scheme field to be your bundle identifier, which is the default URL scheme used by Dynamic Links.

Pettifer answered 9/3, 2020 at 5:44 Comment(0)
K
0

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

Kissinger answered 8/4, 2020 at 11:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.