首页 > 解决方案 > 分支 IO 深层链接自定义别名不起作用。相同的链接不在两个不同的应用程序中共享?

问题描述

我正在创建一个社交媒体类型的应用程序,其中我通过 Branch IO 的深度链接创建了一个共享配置文件。

问题:我为每个用户创建了一个唯一的用户名,并用作共享链接。示例:用户名:sumit1698 分享链接:https ://l.hire.in/sumit1698

但是,当我在创建后第一次将其共享到配置文件时,它可以工作,但是当我将相同的配置文件共享到另一个应用程序时。它显示错误

{"error":{"code":409,"message":"链接别名冲突:l.hire.in/sumit1698"}}

我在分支 IO 中使用自定义别名。

Future<void> buildBranchIOLink(ArtistModel artistModel) async {

BranchUniversalObject buo = BranchUniversalObject(
    canonicalIdentifier: '${artistModel.uid}',
    //canonicalUrl: '',
    title: 'View my profile @${artistModel.name}',
    // imageUrl: '${artistModel.profile}',
    imageUrl: '',
    contentDescription: 'Visit A4H app for booking',
    keywords: ['Plugin', 'Branch', 'Flutter'],
    // publiclyIndex: true,
    locallyIndex: true,
    contentMetadata: BranchContentMetaData()
      ..addCustomMetadata('artist_uid', '${artistModel.uid}')
    // ..addCustomMetadata('artist_id', artistModel.id),
    );

String username = artistModel.systemName != null
    ? artistModel.systemName
    : artistModel.name;


BranchLinkProperties lp = BranchLinkProperties(
    alias: '${username.replaceAll(" ", ".")}', //define link url,
    channel: 'message',
    feature: 'sharing',
    stage: 'new share',
    tags: ['one', 'two', 'three']);
lp.addControlParam('url', 'http://www.google.com');
lp.addControlParam('url2', 'http://flutter.dev');

BranchResponse response = await FlutterBranchSdk.showShareSheet(
    buo: buo,
    linkProperties: lp,
    messageText: 'Hire ${artistModel.name} with A4H',
    androidMessageTitle: '${artistModel.name}',
    androidSharingTitle: '${artistModel.name}');

if (response.success) {
  print('showShareSheet Success');
} else {
  print('Error : ${response.errorCode} - ${response.errorMessage}');
}

bool success = await FlutterBranchSdk.listOnSearch(buo: buo);
print(success);

}

标签: androidflutterdeep-linkingbranch.io

解决方案


推荐阅读