4

Trying to set up branch for deep linking. In settings for the Branch control panel the link domain is set to: get.myapp.co. For iOS the URI Scheme is: myapp://. Under the Associated Domains section of entitlements I have:

applinks:get.myapp.co
applinks:get-alternate.myapp.co

I have my AppDelegate.swift setup as described by the guide.

func application(_ application: UIApplication,

didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

let branch = Branch.getInstance()

        branch?.initSession(launchOptions: launchOptions) { (params, error) in

            //We can handle links when an app is launched/open here
            if let error = error {
                print("Branch error: \(error.localizedDescription)", logType: .Error)
            } else {
                print("Branch params: \(params.description)")
            }

        }


}

Now I have a marketing ink setup in the control panel with the key: redirect and value subscription. When I tap on the link I output I get is:

Branch params: [AnyHashable("+clicked_branch_link"): 0, AnyHashable("+is_first_session"): 0, AnyHashable("+non_branch_link"): http://get.myapp.co/xmas-special-offer]

So +clicked_branch_link is 0. My metadata with the key redirect is also missing. What am I doing wrong here?

EDIT:

Note I was pasting the link from the control panel into an email and then opening it from the mail app, this doesn't work. BUT if I send the link from the control panel via sms the metadata appears and clicked_branch_link is 1. What gives?

KexAri
  • 3,607
  • 4
  • 35
  • 70

2 Answers2

12

Spent a lot of time trying to solve the same issue. My problem was caused by opening test link while using live environment. For using test environment I had to get branch singletone like:

Branch *branch = [Branch getTestInstance];

tema-orange
  • 186
  • 1
  • 7
  • more info at https://dev.branch.io/getting-started/integration-testing/guide/ios/ – eric f. Apr 12 '17 at 00:33
  • What's the difference between `[RNBranch initSessionWithLaunchOptions:launchOptions isReferrable:YES];` and `Branch *branch = [Branch getTestInstance];`do you know please or the use of `RNBranch` and `Branch`? – Michael Stokes Oct 30 '17 at 14:20
3

Alex from Branch here: the +clicked_branch_link: 0 param means that the SDK is not detecting any Branch link click for that device prior to the app launching. This is why you're not getting your metadata back. The presence of +non_branch_link in the return indicates some configuration issues, which are probably causing the failure to detect a Branch link click. Based on some of the details in your question, I think there may be some confusion around how to configure your custom domain and your URI scheme.

Without seeing the specific configuration in your dashboard, this is tough to diagnose. Could you either edit your question with more details (example links, screenshots of the dashboard, etc), or submit a ticket with the Branch integrations team for further debugging?

Alex Bauer
  • 11,741
  • 1
  • 18
  • 35