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

Flutter AppsFlyer延迟深度链接问题:无预安装链接匹配当前设备

AppsFlyer延迟深度链接失效,无法获取参数问题修复

问题描述

  • 应用处于运行状态时,点击深度链接可通过onDeepLinking()方法正常获取所有关联参数
  • 应用未安装时,点击链接跳转至App Store完成安装后,链接无法生效,无法获取传递的参数,返回错误响应:
{
  "scheme": "-----------",
  "request_ip_version": "IP_V4",
  "is_deferred": false,
  "host": "google",
  "link": "----------://google/link/?request_ip_version=IP%5FV4&match_message=No%20pre%2Dinstall%20link%20matched%20for%20this%20device%2E",
  "path": "/link",
  "match_message": "No pre-install link matched for this device."
}

链接示例

https://<MY CUSTOM GENERATED LINK>?deep_link_value=amit

当前AppsFlyer配置代码

final AppsFlyerOptions options = AppsFlyerOptions(
        afDevKey: '<My Development key>',
        //For iOS app id is required
        appId: '<My App id for iOS>',
        timeToWaitForATTUserAuthorization: 15,
        manualStart: false,
      );
      _appsflyerSdk = AppsflyerSdk(options);

      await _appsflyerSdk.initSdk(
        registerOnDeepLinkingCallback: true,
        registerConversionDataCallback: true,
        registerOnAppOpenAttributionCallback: true,
      );

      _appsflyerSdk.startSDK();

      _appsflyerSdk.onAppOpenAttribution((res) {
        print('res: $res');
      });

      _appsflyerSdk.onInstallConversionData((res) {
        print('res: $res');
      });

      _appsflyerSdk.onDeepLinking((DeepLinkResult res) {
        print('res: ${res.toJson()}');
      });

问题分析

错误提示No pre-install link matched for this device表明延迟深度链接(Deferred Deep Link)未正确匹配设备,核心原因包括:

  • 延迟链接参数不会走onDeepLinking()回调,需在onInstallConversionData()中处理
  • iOS Universal Links配置不完整
  • 未使用AppsFlyer OneLink生成合规的深度链接
  • 测试流程不符合延迟链接触发要求

解决方案

1. 正确处理延迟深度链接回调

延迟链接的参数仅会在首次安装打开时,通过onInstallConversionData()返回,修改回调逻辑:

_appsflyerSdk.onInstallConversionData((res) {
  print('install conversion data: $res');
  
  // 识别首次安装的延迟链接场景
  if (res['is_first_launch'] == true && res['deep_link_value'] != null) {
    String targetParam = res['deep_link_value'];
    print('获取到延迟链接参数: $targetParam');
    // 执行跳转对应页面等业务逻辑
  }

  // 另一种判断方式:通过status和type字段
  if (res['status'] == 'SUCCESS' && res['type'] == 'on_install') {
    String? deepLinkParam = res['deep_link_value'];
    if (deepLinkParam != null) {
      // 处理参数逻辑
    }
  }
});

2. 完善iOS端Universal Links配置

  • 在AppsFlyer后台配置正确的OneLink域名(如xxx.onelink.me)
  • iOS项目开启Associated Domains能力,添加applinks:xxx.onelink.me
  • 确认域名根目录或.well-known目录下的apple-app-site-association文件包含AppsFlyer的配置规则

3. 使用OneLink生成合规链接

放弃自定义链接,改用AppsFlyer OneLink生成深度链接,确保参数能被正确追踪和传递到延迟场景中。

4. 规范测试流程

  • 使用真实设备测试,模拟器无法触发延迟链接逻辑
  • 测试前完全卸载应用,重置设备广告标识符(IDFA/AAID)
  • 点击链接后必须通过App Store完成安装,首次打开应用需通过安装后的自动启动,禁止手动打开

5. 调整SDK初始化顺序

将回调注册放在startSDK()之前,确保初始化时回调已绑定:

final AppsFlyerOptions options = AppsFlyerOptions(
  afDevKey: '<My Development key>',
  appId: '<My App id for iOS>',
  timeToWaitForATTUserAuthorization: 15,
  manualStart: true,
);
_appsflyerSdk = AppsflyerSdk(options);

await _appsflyerSdk.initSdk(
  registerOnDeepLinkingCallback: true,
  registerConversionDataCallback: true,
  registerOnAppOpenAttributionCallback: true,
);

// 先注册所有回调
_appsflyerSdk.onAppOpenAttribution((res) {
  print('res: $res');
});

_appsflyerSdk.onInstallConversionData((res) {
  print('res: $res');
});

_appsflyerSdk.onDeepLinking((DeepLinkResult res) {
  print('res: ${res.toJson()}');
});

// 最后启动SDK
_appsflyerSdk.startSDK();

内容的提问来源于stack exchange,提问作者Amit Kava

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.23 21:40:21