We are having problems with the Branch.io link on iOS in our ReactNative app. When our app is installed using a deferred link from Branch.io, we don't receive the link data when the app is opened. However, after the user restarts the app, the link gets handled.
UPDATE
As requested, we are attaching (obfuscated) logs when app was installed via link and logs when app was installed (and minimised) when link was opened. I am also attaching our AppDelegate file
Here is our RN code:
import branch, { BranchSubscriptionEvent } from 'react-native-branch';
useEffect(() => {
const unsubscribe = branch.subscribe((value: BranchSubscriptionEvent) => {
console.log('value', value);
//more handling of the link
};
return unsubscribe;
}, [...dependencyList]);
The object, which is logged into the console when installed on iOS through the link is:
{
"error": null,
"params": {
"+non_branch_link": "com.ourapp.app://google/link/?request_ip_version=IP%5FV4&match_message=No%20pre%2Dinstall%20link%20matched%20for%20this%20device%2E",
"+is_first_session": true,
"+clicked_branch_link": false,
"+rn_cached_initial_event": true
},
"uri": "com.ourapp.app://google/link/?request_ip_version=IP%5FV4&match_message=No%20pre%2Dinstall%20link%20matched%20for%20this%20device%2E"
}
When we just restart the app, the correct link gets handled:
{
"error": null,
"params": {
"~channel": "App",
"+is_first_session": false,
//more fields...
"~feature": "Signup",
"~campaign": "Refferal",
"deeplinkURL": "our custom data to handle link",
"~tags": [
"referral"
]
},
"uri": null
}
The link was created via Branch.io API
{
"data": {
"$desktop_url": "https://ourdomain.com",
"deeplinkURL": "our custom data to handle link"
},
"channel": "App",
"campaign": "Referral",
"feature": "Signup",
"tags": [
"referral"
],
"branch_key": "{{branchKey}}"
}
Any idea why we don't get all the data with first launch of the app? Android works correctly.
I could see that "+clicked_branch_link": false, this can happen, when the keys are mismatched or you are using the wrong quick link (live or test).
Could you please enable logging using this [RNBranch enableLogging]; and share them. To enable Test instance use this RNBranch.useTestInstance()
Please bring the Branch SDK to the top of the App Delegate file and to test the test key should be used before init.
Could you also verify if your app delegate file looks similar to this https://help.branch.io/developers-hub/docs/react-native#ios-1