12

In the documentation it says to add the following lines to my AppDelegate.swift:

  // Set deepLinkURLScheme to the custom URL scheme you defined in your
  // Xcode project.
  FIROptions.default().deepLinkURLScheme = self.customURLScheme

From what I understand this should be the same link you put in your info.plist. However, I'm confused why in the quickstart-ios repo they decided to make this equal to "dlscheme".

Can anybody help me understand what exactly this scheme is?

KENdi
  • 7,576
  • 2
  • 16
  • 31
MarksCode
  • 8,074
  • 15
  • 64
  • 133

1 Answers1

20

This is not clear in the Dynamic Links integration instructions — I ran into the same issue even though I work with these things all day at Branch.io (full disclosure: we're an alternative/improvement to Dynamic Links).

When configuring a custom URI scheme, you need to supply both an Identifier and a URL Scheme. Apple recommends using a reverse domain value for the Identifier, but since your bundle ID is also typically reverse domain format, these two often end up being identical.

By default, Firebase expects you to use your bundle identifier as your custom URI scheme. When you do this, their default configuration takes over and you don't need to specify the FIROptions.default().deepLinkURLScheme = self.customURLScheme line at all. The URI scheme config ends up looking like this, which is a bit counter-intuitive:

enter image description here

However, if you decide to use a value that is not your bundle ID for the URL Scheme (very common), then you DO need the FIROptions.default().deepLinkURLScheme = self.customURLScheme line. But you also need this one before it: let customURLScheme = "somethingelse". You can see this here in the quickstart, and also where the URI scheme is defined in the info.plist file here.

Basically, the Firebase team tried to simplify things by assuming the bundle ID as the custom URI scheme value. This is not a bad option, but it can be confusing and as you can see, even their own quickstart project uses a more advanced config.

Alex Bauer
  • 13,147
  • 1
  • 27
  • 44
  • This is the second Firebase question I've seen you answer, which I find to be both amusing and admirable. Can you shed any light on the `Icon` setting in your screenshot, and where that ends up appearing in dynamic link flow(s)? – Matt Mc Apr 04 '18 at 18:26
  • @MattMc knowledge knows no bounds! Thanks for the kind words. I actually have no idea what the icon is for — I'd never really thought about it. [This answer](https://stackoverflow.com/a/8201925/5394680) seems to suggest it's something to do with macOS – Alex Bauer Apr 04 '18 at 21:12
  • @AlexBauer can we test in build installed from Xcode? or i need to upload to TestFlight to test this? – sulabh Aug 24 '18 at 13:41
  • 1
    @sulabh you should be able to test Deferred link behavior via Xcode just fine — install the build, generate a link, delete the app, click the link and then follow it through to the App Site but DON'T install, and then install the build from Xcode again and open it. – Alex Bauer Aug 24 '18 at 13:55
  • Thanks for your answer @AlexBauer ! Helped me after i found this root cause from their self diagnostic tool (https://firebase.google.com/docs/dynamic-links/debug#ios_self-diagnostic_tool). – BigMcLargeHuge Jan 05 '20 at 00:10