Firebase Dynamic Links无法在安装过程中幸免 [英] Firebase Dynamic Links does not survive installation process

查看:237
本文介绍了Firebase Dynamic Links无法在安装过程中幸免的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Firebase Dynamic Link吊舱更新为1.4版本.在此版本中,我发现了一个非常有用的名为FIRDynamicLinkComponents的类.我决定使用它来生成动态链接.但是我有两个问题:

I updated Firebase Dynamic Link pod to 1.4 version. In this version I found very useful class named FIRDynamicLinkComponents. I decided to use it to generate dynamic links. But I have 2 problems:

  1. Firebase文档说动态链接可以在安装过程中幸免,并且可以在我从AppStore安装后在动态链接中描述的内容上打开应用程序.这是行不通的.
  2. 未安装应用程序的用户点击动态链接时,将看到带有在应用程序中打开"按钮的奇怪屏幕.单击后,出现AppStore.

我们可以跳过此屏幕吗?

Can we skip this screen?

我的实现:

static func createDynamicLinks(forChallangeId challangeId: String, authorId: String, authorEmail: String, completion: @escaping (_ dynamicLink: String?, _ error: Error?) -> Void) {
    let link = URL(string: "https://CODE.app.goo.gl/challange/\(challangeId)/author/\(authorId)")!
    let domain = DOMAIN
    let components = FIRDynamicLinkComponents(link: link, domain: domain)

    //add iOS params
    let iOSParams = FIRDynamicLinkIOSParameters(bundleID: bundleId)
    iOSParams.appStoreID = APP_STORE_ID
    components.iOSParameters = iOSParams

    //add Android params
    let androidParams = FIRDynamicLinkAndroidParameters(packageName: PACKAGE_NAME)
    androidParams.minimumVersion = 19
    components.androidParameters = androidParams

    //add social meta tag params
    let socialParams = FIRDynamicLinkSocialMetaTagParameters()
    socialParams.title = "You got new challenge"
    socialParams.descriptionText = "\(authorEmail) sent the challenge to you."
    socialParams.imageURL = IMAGE_URL
    components.socialMetaTagParameters = socialParams

    //add options
    let options = FIRDynamicLinkComponentsOptions()
    options.pathLength = .short
    components.options = options

    //make link shorter
    components.shorten { (shortURL, warnings, error) in
        if let error = error {
            completion(nil, error)
            return
        }
        guard let shortLinkString = shortURL?.absoluteString else {
            completion(nil, error)
            return
        }

        completion(shortLinkString, error)
    }
}

编辑

第三个问题.

Edit

3rd problem.

目标iOS10.处理:

Target iOS10. Handle:

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
    guard let dynamicLinks = FIRDynamicLinks.dynamicLinks() else {
        return false
    }

    let handled = dynamicLinks.handleUniversalLink(userActivity.webpageURL!) { (dynamiclink, error) in
        if let url = dynamiclink?.url {
            DynamicLinksManager.handleDeepLink(link: url)
        }
    }

    return handled
}

handled为true,但在闭包中dynamiclinkerror为nil.

handled is true but in closure dynamiclink and error are nil.

推荐答案

许多解决方案都依赖于比您当前包含的上下文更多的上下文.我将编辑此答案并尽可能进行更新.

A lot of solutions depend on having more context than you've currently included. I'll edit this answer with updates as possible.

    在大多数情况下,
  1. 动态链接绝对可以在安装过程中幸免.但是,有很多极端情况.您可以为要测试的过程添加特定的复制步骤吗?
  2. 不,很遗憾,不能跳过此模式.苹果在iOS 10.3中进行了一些更改,这些更改不可避免(
  1. Dynamic Links definitely can survive the installation process in most situations. However, there are a lot of edge cases. Could you add specific reproduction steps for exactly the process you're using to test?
  2. No, unfortunately this modal cannot be skipped. Apple made some changes in iOS 10.3 that make something like this unavoidable (read here for more on what happened, and how we handled the same problem in a slightly more elegant way at Branch)
  3. This might be expected, if no valid Dynamic Link were triggered. Again, could you add specific reproduction steps?

这篇关于Firebase Dynamic Links无法在安装过程中幸免的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆