iOS 9和x2B的Branch.io链接;问题
我在我的项目中使用Branch.io从我的网站启动应用程序。我想要的是,如果应用程序关闭,当我点击网站上的通用链接时,它会首先打开主页。相反,它打开了另一个窗口。它在iOS 8上运行良好。但在iOS 9+中,它总是打开启动屏幕 请看一下我的代码: AppDelegate:iOS 9和x2B的Branch.io链接;问题,ios,swift,deep-linking,branch.io,ios-universal-links,Ios,Swift,Deep Linking,Branch.io,Ios Universal Links,我在我的项目中使用Branch.io从我的网站启动应用程序。我想要的是,如果应用程序关闭,当我点击网站上的通用链接时,它会首先打开主页。相反,它打开了另一个窗口。它在iOS 8上运行良好。但在iOS 9+中,它总是打开启动屏幕 请看一下我的代码: AppDelegate: func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?)
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
let branch = Branch.getInstance()
branch.initSessionWithLaunchOptions(launchOptions) { (params, error) -> Void in
DHIndicator.hide()
if let _ = params {
print("kdlkasdlf: \(params.debugDescription)")
if let str = params["$deeplink_path"], url = NSURL(string: str as! String) {
NSLog("link: \(url)")
self.path = url.path
self.query = url.query
LaunchAppFlowManager.shareInstance.displayLaunchDetails()
} else {
// load your normal view
}
}
}
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.makeKeyAndVisible()
window?.backgroundColor = UIColor.whiteColor()
AccountFlowManager.shareInstance.start()
}
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
Branch.getInstance().handleDeepLink(url)
if AppDelegate.shareInstance().window?.rootViewController?.nibName != "LaunchScreenVC" {
DHIndicator.show()
}
return true
}
func application(application: UIApplication, continueUserActivity userActivity: NSUserActivity, restorationHandler: ([AnyObject]?) -> Void) -> Bool {
print(userActivity.webpageURL?.absoluteString)
if AppDelegate.shareInstance().window?.rootViewController?.nibName != "LaunchScreenVC" {
DHIndicator.show()
}
return Branch.getInstance().continueUserActivity(userActivity)
}
和,func启动应用程序:
if let _ = AppDelegate.shareInstance().path, _ = AppDelegate.shareInstance().query {
let navi = UINavigationController(rootViewController: HomePageVC())
self.navi = navi
AppDelegate.shareInstance().window?.rootViewController = navi
} else {
let vc = LaunchScreenVC()
AppDelegate.shareInstance().window?.rootViewController = vc
}
总结一下这个问题:
此外,在Branch init completion块中定位用于应用内路由的代码非常重要,因为此完成块仅在收到来自Branch服务器的响应且链路参数可用后运行。如果应用内路由的代码位于完成块之外(且未被完成块调用),则很可能在Branch实际返回链接参数之前做出路由决策。Alex with Branch.io here:听起来您的应用中可能没有完全配置通用链接。我们可以看看您用于测试的示例链接吗?如果你不想公开分享这些信息,请放心吧!这里有两个测试链接:和。我也已经提交了一张票。所以请检查一下。我们会看一下,然后再给你回复。谢谢你的链接@请再检查一下我的电子邮件。我想我遇到了同样的问题@亚历克斯鲍尔,你能帮忙吗?