Firebase dynamic links always opens app store

Viewed 7693

I have been trying to get dynamic links working all day to no success.

I have created a dynamic link using firebase web and with a google provided link. I have added the associated domains as instructed (applinks:https://myapp.page.link/sZZL), and also have firebase hosting set up.

On firebase I have checked the Team ID and App store ID (its not released to the app store, but in uploaded to apple developer account and so has an ID) are correct.

The url type is set up correctly, with the bundle id set.

If I open the link in chrome, it redirects to the app just fine.

I've tried sending a email with the link and adding it to notes and opening from there. All open the app preview page which then redirects to the app store.

Thee app is not on the app store yet as it is in development - would this impact it?

I simply want it to redirect to the app (which is on the phone in question) rather than the app store

4 Answers

To get your dynamic links to work properly on iOS, you need to set up:

  1. associated domains This property sets up in custom entitlements file and looks like

<key>com.apple.developer.associated-domains</key>
<array>
    <string>applinks:myapp.page.link</string>
</array>
  1. Url types In info.plist add URL types that firebase will use by default

<key>CFBundleURLTypes</key>
<array>
    .... Some others url schemes
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLName</key>
        <string>Bundle ID</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>your.bundle.id</string>
        </array>
    </dict>
    ....
</array>

Also, you should add Team ID (required) and App Store ID (if your app not published, you can use App Store ID of any another app as a temporary solution, but also required)

For more information see firecast

For handling links in application use this

Please check the link setup in associated domains. It should not include https or www.

For example:

It should be something like: "applinks:appname.page.link"

But it should not be something like: "applinks:https://appname.page.link" or "applinks:www.appname.page.link"

I had the same issue that my app always went to the App Store page. The app was already live. I followed the complete instructions about Associated Domains etc, all setup was correct.

What my issue was that Firebase asks for Team ID & App ID. The Team ID is used in the apple-app-site-association so you would get something like:

{"applinks":{"apps":[],"details":[{"appID":"TEAMID.bundleID","paths":["NOT /_/*","/*"]}]}}

I noticed in my app Identifier in Developer Center (at certificates & profiles) when you press the identifier that you're working with on the top right there is an App ID Prefix stated. And for most (newer) apps that will be the same as the Team ID but sometimes it's different.

When it's different, in Firebase at the Team ID field you should enter the App ID Prefix!

After a while (took me 15 min or so) the apple-app-site-association will be changed and the new prefix will be shown. Again after some time my Firebase Dynamic Links started to work nicely.

Hope this helps some people that have the same problem and save them some time.

I solved it using help from @Mark Iliev's answer, but my case was a bit different.

Initially I had a Firebase domain specified in the Associated Domains, like applinks:myproject.page.link.

Then I configured my custom domain to be used, and when I updated the associated domains section, XCode told me that a new entitlements file will be created, so it added a file MyProjectRelease.entitlements to the project with the updated Custom domain.

But, the original MyProject.entitlements file still had the old Firebase domain name present in it. Updating the domain in the new MyProject.entitlements to my custom domain solved this issue.

    <dict>
       <key>aps-environment</key>
       <string>development</string>
       <key>com.apple.developer.associated-domains</key>
       <array>
           <string>applinks:mycustomdomain.com</string>
       </array>
    </dict>
Related