You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

添加$android_url/$ios_url后Branch SDK生成超长链接问题咨询

解决Branch短链接添加自定义参数后冗长的问题

解决方案

1. 后台配置默认跳转链接(推荐)

在Branch管理后台的「链接设置」-「重定向」页面,配置iOS和Android平台未安装应用时的默认网页跳转地址。这样无需在代码中手动添加$ios_url和$android_url参数,生成的短链接会自动遵循后台规则跳转,同时保持链接简洁。

2. 强制生成短链接类型

若需动态设置不同的跳转链接,在BranchLinkProperties中指定linkType: LinkType.SHORT,确保SDK生成服务器存储型短链接,而非将所有参数编码到URL中的动态链接:

return await FlutterBranchSdk.getShortUrl(
  buo: BranchUniversalObject(
    canonicalIdentifier: 'evershop/post',
    canonicalUrl: 'https://web.evershop.ai/p/$id',
    title: 'EverShop Post',
    keywords: ['post'],
  ),
  linkProperties: BranchLinkProperties(
    tags: ['post'],
    campaign: 'post',
    feature: 'post',
    channel: 'post',
    alias: 'p/$id',
    linkType: LinkType.SHORT, // 强制生成短链接
  )
    ..addControlParam('\$ios_url', 'https://web.evershop.ai/p/$id')
    ..addControlParam('\$android_url', 'https://web.evershop.ai/p/$id'),
);

3. 移除不必要的控制参数

如果不需要直接跳转至APP URI(绕过Branch的中间处理页),删除$uri_redirect_mode=1参数。该参数会强制直接跳转,导致Branch无法在服务器端存储链接数据,只能将所有参数编码到URL中,造成链接冗长。

问题原因

添加$ios_url和$android_url参数后,SDK默认生成动态链接,将BranchUniversalObject的所有数据编码到URL中;再加上$uri_redirect_mode=1的影响,进一步阻止了Branch服务器对链接的优化处理,最终导致链接异常冗长。同时自定义别名未被正确应用,也是因为动态链接模式下别名的优先级被忽略。


内容的提问来源于stack exchange,提问作者Muhammad Talha

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.02 18:10:04