Quickstart-ios: Firebase Dynamic Link cannot open app directly

Created on 7 Apr 2019  路  5Comments  路  Source: firebase/quickstart-ios

Clicking on the dynamic link pasted in Notes is not opening the app when the app is installed through xcode. It opens safari every time and lands on the preview page, clicking open button will direct me to app store.

Here are the things that I've done:

  1. Set associated domain in the format of applinks:example.page.link in capabitilies tab
  2. Set url types in info tab, filling in bundle ID for URL Schemes
  3. Checked device log as suggested but cannot find any info about aasa file downloaded into phone
  4. Checked that associated domain in provisioning profiles is enabled
  5. Validated aasa file using aasa validator tool with the results all passed
  6. Tested on devices with ios 11 and 12

UPDATE
Found out that AppId Prefix is not equal to Team ID and the aasa file is showing "appID":"[TEAM_ID].[BUNDLE_ID]". Should it be using app prefix instead of team ID?

Below are the codes for reference

    func application(_ application: UIApplication, continue userActivity: NSUserActivity,
                     restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
        let handled = DynamicLinks.dynamicLinks().handleUniversalLink(userActivity.webpageURL!) { (dynamiclink, error) in
            guard error == nil else {
                print("Error: \(error!.localizedDescription)")
                return
            }
            if let dynamicLink = dynamiclink {
                self.handleDynamicLink(dynamicLink)
            }
        }
        return handled
    }

    @available(iOS 9.0, *)
    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any]) -> Bool {
        return application(app, open: url,
                           sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,
                           annotation: "")
    }

    func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {

        if let dynamicLink = DynamicLinks.dynamicLinks().dynamicLink(fromCustomSchemeURL: url) {
            if dynamicLink.matchType == .unique {
                handleDynamicLink(dynamicLink)
            } 
            return true
        } 
        return false
    }

Most helpful comment

For future reference, if anyone stumbles upon this, DO NOT change the Team ID setting to your App ID Prefix blindly, as this will break Cloud Messaging when used with the Auth Key (ref: https://github.com/firebase/quickstart-ios/issues/381).

I have filed a ticket through the "proper" support channels to bring back the App ID Prefix field to the Firebase Console App Settings page. It seems the Team ID field was titled App ID Prefix earlier and only the title was changed when in reality we need both of these fields to support the combination:

  1. Legacy iOS app where App ID Prefix is different from Team ID
  2. Cloud Messaging with team-wide Auth key (needs Team ID)
  3. Dynamic Links with auto-generated AASA file (needs App ID Prefix)

EDIT: If you are developing a legacy iOS app, you should consider migrating the App ID Prefix to the Team ID as per this Technical Note: https://developer.apple.com/library/archive/technotes/tn2311/_index.html

All 5 comments

Changed Team id to app prefix in firebase settings and it works.

Changed Team id to app prefix in firebase settings and it works.

are you sure this change was how your issue was resolved?

The team I work with solved this by adding the URL prefix /{ your_dynamic_links_domain} to the Associated Domains of our iPhone app as laid out in the Firebase Dynamic Links documentation.

For future reference, if anyone stumbles upon this, DO NOT change the Team ID setting to your App ID Prefix blindly, as this will break Cloud Messaging when used with the Auth Key (ref: https://github.com/firebase/quickstart-ios/issues/381).

I have filed a ticket through the "proper" support channels to bring back the App ID Prefix field to the Firebase Console App Settings page. It seems the Team ID field was titled App ID Prefix earlier and only the title was changed when in reality we need both of these fields to support the combination:

  1. Legacy iOS app where App ID Prefix is different from Team ID
  2. Cloud Messaging with team-wide Auth key (needs Team ID)
  3. Dynamic Links with auto-generated AASA file (needs App ID Prefix)

EDIT: If you are developing a legacy iOS app, you should consider migrating the App ID Prefix to the Team ID as per this Technical Note: https://developer.apple.com/library/archive/technotes/tn2311/_index.html

@tsilvone you are the best with this answer. Finally, it's working.

Why not support BOTH Team ID and App Id Prefix.

For dynamic linking that are both auto-generated or otherwise, we need App ID, but for cloud messaging we need Team ID.

There must be something under the hood that is causing such confusion about what to do...allow modifying them both, please! I am considering migrating to an entire new app to avoid the pain this is causing.

Was this page helpful?
0 / 5 - 0 ratings