简体   繁体   中英

Firebase Dynamic Link doesn't work when installing app from appstore for the first time

I'm using Firebase Dynamic Link to share my app (>=IOS 9) and invite people to events (I mean if you have the app you can join the event with the DeepLink and if you don't have it, I'll be sending you to the appstore to download the app before joining the event).

I follow the Firebase docs step:

  • I'm getting the relevant JSON at https://app_code.app.goo.gl/apple-app-site-association .
  • If my app is installed, the DeepLink is working great.
  • If my app isn't installed , the Deeplink send you to the appstore, but when opening for the first time, it doesn't work and you can't join the event.

Here is my code for getting the link on first install:

in didFinishLaunchingWithOption :

    FIROptions.default().deepLinkURLScheme =  "com.jerem.ProjectAlphaSasasa"
// "com.jerem.ProjectAlphaSasasa" is my app bundle Identifier
    FIRApp.configure()

and based on Firebase docs, on first opening, I'm using the following functions:

//MARK: First entry
//when your app is opened for the first time after installation on any version of iOS.
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {
    print("00000000000000000")
    FIRCrashMessage("Link during first installation")
    downloadEventWithDeepLink = true
    downloadUrl = url
    return application(app, open: url, sourceApplication: nil, annotation: [:])

}

//same as previous but for older version ios 8 (not relevant)
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
    let dynamicLink = FIRDynamicLinks.dynamicLinks()?.dynamicLink(fromCustomSchemeURL: url)
    if let dynamicLink = dynamicLink {

        downloadEventWithDeepLink = true
        downloadUrl = dynamicLink.url
        return true
    }

    return false
}

In my case, downloadEventWithDeepLink is a flag (global) I check after user's login to my app (and use there the downloadUrl variable). What am I doing wrong with the setup?

Also, I don't know how to debug it. Is there a way to simulate an Appstore first install in Xcode? To find out if the previous functions (Open Url) are called?

Thanks for your help!

I think to test your implementation is by deleting the app and clicking on the link, once it takes you to the App Store, you don't install the app from there and instead install from Xcode, you should receive the dynamic link call.

As a recommendation, don't worry too much about that, you should focus on testing that your dynamic link does open the app if its installed. test that it works when the app has launched and when it was closed.

If your having issues redirecting to your app, check that you have registered your bundle identifier in the url types and added your domain as applinks:your_dynamic_links_domain in the capabilities tab. If you're using a custom domain, you also have to register it into your info.plist.

I have never set the FIROptions.default().deepLinkURLScheme variable in my projects and all of them work fine

I had the same problem with link not getting received after install. The problem was that my url scheme wasn't correctly setup.

To make it work I changed the URL types in the Info part of my target : I set the bundle ID in identifier and URL schemes field.

URL 方案设置

I also add a line in my setup code of firebase :

FIRApp.configure()
FIROptions.default().deepLinkURLScheme = "fr.machin.ES5"

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