简体   繁体   中英

What is customURLScheme in Firebase Dynamic Links?

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?

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:

在此输入图像描述

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.

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