Raildex
Raildex

Reputation: 4727

Firebase Dynamic link opens Weblink instead of App Store when app is not installed

I am using Firebase Dynamic links to send informations via Mail. The links work when i try to open them when the app is installed. However they do not work correctly when the app is not installed.
When i open a link when the app is not installed, they open my homepage, more precise the actual link. My code is here:

static func generateDynamicLinkFromProduct(product: Product, completion: @escaping (URL?) -> Void) {
    let domain = "https://my-homepage.com/"
    let bundleID = Bundle.main.bundleIdentifier
    var package = "my.app.on.android"
    let meta = product.metaJson!
    guard let link = URL(string: domain + "product=" + meta) else {
        completion(nil)
        return
    }
    let dynamicLinksDomainURIPrefix = "https://myapp.page.link"
    let linkBuilder = DynamicLinkComponents(link: link, domainURIPrefix: dynamicLinksDomainURIPrefix)
    linkBuilder?.iOSParameters = DynamicLinkIOSParameters(bundleID: bundleID!)
    linkBuilder?.iOSParameters?.appStoreID = "APP_STORE_ID"
    linkBuilder?.navigationInfoParameters = DynamicLinkNavigationInfoParameters()
    linkBuilder?.navigationInfoParameters?.isForcedRedirectEnabled = true
    linkBuilder?.androidParameters = DynamicLinkAndroidParameters(packageName: package)
    let options = DynamicLinkComponentsOptions()
    options.pathLength = .short
    linkBuilder?.options = options
    let longLink = linkBuilder?.url
    print(longLink)
    linkBuilder?.shorten() { url, warnings, error in
        print(url)
        if (error == nil) {
            completion(url)
        } else {
            completion(nil)
        }
    }
}

(domain, bundle,package and prefix are replaced by the data of the actual app)

The dynamic link opens the actual content of link, i.e. it opens https//my-homepage.com/product=

the output of the debug shows this:

e

€dit: The generated long link contains isi and ibi parameters

Upvotes: 2

Views: 716

Answers (1)

Dries Cleymans
Dries Cleymans

Reputation: 890

Check your appStoreId.

I had the same problem and it turned out I switched my developer team ID with the appStoreId of my application.

Upvotes: 1

Related Questions