Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 505
jerem Avatar asked Jan 04 '17 19:01

jerem


People also ask

Do Firebase dynamic links work on iOS?

In the Firebase console, open the Dynamic Links section. Accept the terms of service if you are prompted to do so. Ensure that your app's App Store ID and your App ID prefix is specified in your app's settings. To view and edit your app's settings, go to your Firebase project's Settings page and select your iOS app.

How do I create a dynamic link in Firebase?

You create a Dynamic Link either by using the Firebase console, using a REST API, iOS or Android Builder API, or by forming a URL by adding Dynamic Link parameters to a domain specific to your app. These parameters specify the links you want to open, depending on the user's platform and whether your app is installed.

Are Firebase dynamic links free?

Dynamic Links are smart URLs that allow you to send existing and potential users to any location within your iOS or Android app. They survive the app install process, so even new users see the content they're looking for when they open the app for the first time. Dynamic Links are no-cost forever , for any scale.


1 Answers

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

like image 158
Diego Garcia Avatar answered Sep 19 '22 12:09

Diego Garcia