Reputation: 609
The link doesn't capture data when I tap and opens the app
let branch = Branch.getInstance()
branch.initSession(launchOptions: launchOptions) { params, error in
guard error == nil else { return }
guard let userDidClick = params?["+clicked_branch_link"] as? Bool else { return }
if userDidClick {
guard let params = params as? [String: AnyObject] else { return }
print("deep link data: ", params)
guard let type = params[kType] as? String else { return }
}
}
When tap the link directly(from WhatsApp/slack/skype) it opens the app directly and I receive
[AnyHashable("+clicked_branch_link"): 0, AnyHashable("+is_first_session"): 0]
When the same link opens in safari it redirects to the app then I get proper params
[AnyHashable("~creation_source"): 0, AnyHashable("+click_timestamp"): 1618546463, AnyHashable("~id"): 900551511xxx37328, AnyHashable("+match_guaranteed"): 0, AnyHashable("$one_time_use"): 0, AnyHashable("+clicked_branch_link"): 1, AnyHashable("region"): XX, AnyHashable("$ios_passive_deepview"): branch_passive_default, AnyHashable("+is_first_session"): 0, AnyHashable("type"): wallet, AnyHashable("$matching_ttl_s"): 7200, AnyHashable("~referring_link"): https://xxxxxx.app.link/8KxKoxmHGeb]
why I am facing this different behavior? I have gone through the branch documentation 3-4 times. nothing is missing but I don't know why I am facing this issue.
Upvotes: 0
Views: 606
Reputation: 609
In my AppDelegate class, my delegate method was like this which was depreciated
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void)
I just changed it to like this and it works now
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void)
Upvotes: 2