首页 > 解决方案 > 应用程序无法通过分支深层链接 url 启动

问题描述

我正在使用 branch.io SDK 在我的应用程序中进行深度链接。直到最近我们的一些 iOS 应用程序开始表现出非常奇怪的行为,它运行良好。我们为用户创建的分支链接(深层链接)无法在某些具有 iOS 12 或更高版本的随机设备中启动应用程序。

我在我的服务上托管了 AASA 文件(尽管我知道分支已经为我们托管了一个文件)。我已经完成了 Branch 文档中提供的故障排除过程。但我仍然无法确定问题所在。我还通过 AASA 验证器验证了我的网站。

    let buo = BranchUniversalObject(canonicalIdentifier: "content/123")
    buo.canonicalUrl = path
    buo.title = "some title"
    buo.contentDescription = "Some description"
    buo.imageUrl = restaurant.logo

    let blp: BranchLinkProperties = BranchLinkProperties()
    blp.feature = "sharing"
    blp.campaign = "Some random text"
    blp.stage = "new user"

    blp.addControlParam("$ios_url", withValue: path)
    blp.addControlParam(kAPIKey_BranchImageId, withValue: "\(imageId)")
    blp.addControlParam(kAPIKey_BranchStoreId, withValue: "\(restaurant.id)")
    blp.addControlParam("$desktop_url", withValue: path)
    blp.addControlParam("$android_url", withValue: path)
    blp.addControlParam("$blackberry_url", withValue: path)
    blp.addControlParam("$windows_phone_url", withValue: path)

    //Get Branch Short URL & share via UIActivityViewController
    buo.getShortUrl(with: blp) { (shortURL, _) in
        log.debug("Branch short url:\(shortURL ?? "")")
        var shareItems: [Any] = []
        if let shorturl = shortURL {
            shareItems += [shorturl]
        } else {
            shareItems += [path]
        }
    }

只要我点击分支 url(来自 notes 应用程序),它就会打开 safari。如果我长按该链接,它不会提供在相应应用程序中打开的选项,该应用程序用于提供。当在 safari 中打开链接时,会显示错误。错误警报消息 ->“Safari 无法打开页面,因为地址无效”。然后重定向到我各自的网站 URL。在此之后,当我(手动)返回应用程序时,分支链接应该传递的数据由分支回调接收,并且一切正常。所以,我主要关心的是为什么分支链接无法打开应用程序。

标签: iosswiftbranchdeep-linkingios-universal-links

解决方案


推荐阅读