在 React Native 应用程序中使用 Branch.io 在 iOS 中延迟深度链接
Deferred Deep Linking in iOS using Branch.io in a React Native App
我们已经使用 Branch.io 在我们的分支中实现了延迟深度 linking。该流程在我们的 Android 构建中正常工作,但在 iOS 中不正常。在 iOS 设备中点击 deep link 时,应用程序已正确安装,但 deep link 的延迟内容部分无法正常工作。 branch validate
gem全绿了
相关代码为:
branch.subscribe(async ({ error, params, uri }) => {
if (error) {
console.error(`Error from Branch: ${error}`);
return;
}
if (params['+non_branch_link']) {
return;
}
if (!params['+clicked_branch_link']) {
return;
}
const deepLink = params.$deeplink_path;
if (deepLink) {
Linking.openURL(deepLink).catch((e) => { console.log('[Branch Error]', e); });
}
});
从来没有能够用现有的范例解决这个问题。最后只是在我的 if 块内设置状态,如果设置了状态,则将用户重定向到不正确的屏幕。一定是某种竞争条件。
¯\ (ツ)/¯
您是否尝试将 initSessionTtl 时间设置为大约 10 秒?
componentDidMount() {
branch.initSessionTtl = 10000;
branch.subscribe(({ error, params, uri }) => {
//Handle the deep link here
});
}
我们已经使用 Branch.io 在我们的分支中实现了延迟深度 linking。该流程在我们的 Android 构建中正常工作,但在 iOS 中不正常。在 iOS 设备中点击 deep link 时,应用程序已正确安装,但 deep link 的延迟内容部分无法正常工作。 branch validate
gem全绿了
相关代码为:
branch.subscribe(async ({ error, params, uri }) => {
if (error) {
console.error(`Error from Branch: ${error}`);
return;
}
if (params['+non_branch_link']) {
return;
}
if (!params['+clicked_branch_link']) {
return;
}
const deepLink = params.$deeplink_path;
if (deepLink) {
Linking.openURL(deepLink).catch((e) => { console.log('[Branch Error]', e); });
}
});
从来没有能够用现有的范例解决这个问题。最后只是在我的 if 块内设置状态,如果设置了状态,则将用户重定向到不正确的屏幕。一定是某种竞争条件。
¯\ (ツ)/¯
您是否尝试将 initSessionTtl 时间设置为大约 10 秒?
componentDidMount() {
branch.initSessionTtl = 10000;
branch.subscribe(({ error, params, uri }) => {
//Handle the deep link here
});
}