gpt4 book ai didi

ios - 分支深层链接未打开应用程序

转载 作者:IT王子 更新时间:2023-10-29 07:59:25 25 4
gpt4 key购买 nike

我一直在尝试(未成功)使用 Branch实现到我们的 iOS 应用程序的深度链接。 Branch URL 直接重定向到 App Store,从不尝试打开应用程序。我一定是遗漏了什么。

我做了什么:

  1. 包含 Branch SDK (CocoaPods) 添加 branch_key 到应用程序列表

  2. 在应用程序 plist 的 URL 类型中添加了 URL Scheme

  3. 在项目和 App ID 中启用Associated Domains开发者控制台。

  4. 确保授权文件包含在构建中。

  5. 在 AppDelegate 中注册深层链接处理程序

仪表板:设置 -> 链接设置:

  1. “始终尝试打开应用”已选中

  2. “IOS URI 方案”设置为应用程序的自定义 URI 方案。

  3. “启用通用链接”已选中。

  4. Bundle Identifier 和 Apple App Prefix 均已正确设置。

    在 Branch Dashboard 中的“Marketing”选项卡下,我创建了一个链接。我将此链接通过电子邮件发送给自己,并在设备 (Mail.app) 上打开它。 Safari 打开,然后打开 App Store,就好像应用程序没有安装一样。

application:openURL:sourceApplication:annotationapplication:continueUserActivity:restorationHandler 都没有被调用。

AppDelegate 方法:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let branch: Branch = Branch.getInstance()
branch.initSessionWithLaunchOptions(launchOptions, andRegisterDeepLinkHandler: { params, error in
if (error == nil) {
// params are the deep linked params associated with the link that the user clicked -> was re-directed to this app
// params will be empty if no data found
// ... insert custom logic here ...
NSLog("params: %@", params.description)
}
})
return true
}

func application(application: UIApplication, continueUserActivity userActivity: NSUserActivity, restorationHandler: ([AnyObject]?) -> Void) -> Bool {
// pass the url to the handle deep link call

return Branch.getInstance().continueUserActivity(userActivity)
}

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
// pass the url to the handle deep link call
Branch.getInstance().handleDeepLink(url);

// do other deep link routing for the Facebook SDK, Pinterest SDK, etc
return true
}

我是否缺少配置步骤?这是因为应用程序是通过 Xcode 调试而不是通过应用商店安装的吗?我期待看到应用程序委托(delegate)方法被调用,但实际上并没有。

最佳答案

似乎必须通过 App Store/Test Flight/Ad Hoc 安装该应用程序,否则该应用程序将不会被视为已安装。

我使用 Ad Hoc 条款将应用程序安装到我的设备上,一切正常。

关于ios - 分支深层链接未打开应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35138257/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com