trusk
trusk

Reputation: 1703

iOS App Delegate params dictionary doesn't contain any relevant links

I've added the Branch.io SDK to my iOS project. I have a custom URL scheme which works fine, I've added universal app links which work fine.

Now, I've enabled in my Dashboard the iOS app where I've added my custom URL scheme, custom URL for downloading the app, the App Prefix and the bundle identifier.

In the 'quick links' section I've created a quick link witch has a ["key": "value"] pair for the deep link section and added a redirect again to my jenkins where the ipa can be downloaded.

Now, if I access that link by copy/pasting in mobile safari, without the app installed i'm correctly taken to Jenkins.

At this point I run the app from xcode, and in app delegate I have

branch = Branch.getInstance()
    branch.initSession(launchOptions: 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 ...
            print("params: %@", params as? [String: AnyObject] ?? {})
        } else {
            print(error?.localizedDescription ?? "")
        }
    })

The issue is here that params always only contains two params:

params: %@ ["+clicked_branch_link": 0, "+is_first_session": 0]

I've also implemented

func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
    let branchHandled = branch.application(application,
                                                         open: url,
                                                         sourceApplication: sourceApplication,
                                                         annotation: annotation
    )

    if (!branchHandled) {
        // If not handled by Branch, do other deep link routing for the Facebook SDK, Pinterest SDK, etc

        var handled = false

        handled = //this is Facebook handling

        guard handled == false else { return true }
    } else {
        // do some stuff if it's coming from branch
    }

    return branchHandled
}

My interest is for branch to pass my ["key": "value"] pair in order to have it handled like a deep link at this point, but I don't know what else to try.

Upvotes: 3

Views: 546

Answers (1)

Parth Kalavadia
Parth Kalavadia

Reputation: 119

The failure of deferred deep-linking could be due to mismatch of Branch key and Branch link for a particular Branch app. Verify the Branch link used for deferred deep-linking is generated using the same Branch key which is used in info.plist of the iOS project.

Upvotes: 1

Related Questions