Firebase动态链接无法在安装过程中生效

时间:2017-05-05 10:20:39

标签: ios firebase firebase-dynamic-links

我将Firebase动态链接广告更新为1.4版。在这个版本中,我发现了一个名为FIRDynamicLinkComponents的非常有用的类。我决定用它来生成动态链接。但我有两个问题:

  1. Firebase doc说,从AppStore安装后,动态链接可以在安装过程中运行,并在我在动态链接中描述的内容上打开应用程序。这不行。
  2. 当没有安装app的用户点击动态链接时,他会看到带有按钮的奇怪屏幕"在App"中打开。点击AppStore后出现。
  3. enter image description here 我们可以跳过这个屏幕吗?

    我的实施:

    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)
        }
    }
    

    修改

    第3个问题。

    目标iOS10。处理:

    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为真,但在结束时dynamiclinkerror为零。

0 个答案:

没有答案