【问题标题】:onAppOpenAttribution not called for deep links with AppsFlyer与 AppsFlyer 的深层链接不调用 onAppOpenAttribution
【发布时间】:2017-08-07 11:16:25
【问题描述】:

我已将 AppsFlyer SDK 集成到我的项目中。我设法让深层链接正常工作。我在 OneLink 中创建的任何链接都会根据需要打开应用程序。但是我无法访问链接参数。我已经实现了以下所有委托方法:

func onAppOpenAttribution(_ attributionData: [AnyHashable : Any]!) {
    print("Test 1")
}

func onAppOpenAttributionFailure(_ error: Error!) {
    print("Test 2")
}

func onConversionDataReceived(_ installData: [AnyHashable : Any]!) {
    print("Test 3")
}

func onConversionDataRequestFailure(_ error: Error!) {
    print("Test 4")
}

当我的应用从深层链接打开时,没有一个会被调用。我在这里想念什么?在控制面板中配置的 URL 中,我将 mycompany:// 配置为 Mobile deeplink URL。对此的任何指示都会很棒。谢谢!

【问题讨论】:

  • 您使用什么 iOS SDK 版本?你注册delegate了吗?如果您打开应用程序不是通过深层链接,onConversionDataReceived 被调用?另请发布 AppsFlyer 初始化
  • @MaximShoustin onConversionDataReceived 你知道为什么即使我设置了 delegate = self 也不被调用

标签: ios appsflyer appsflyer-ios-sdk


【解决方案1】:

如果您还没有,请将以下方法添加到您的委托:

// Reports app open from a Universal Link for iOS 9
- (BOOL) application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *_Nullable))restorationHandler {    
    [[AppsFlyerTracker sharedTracker] continueUserActivity:userActivity restorationHandler:restorationHandler];
    return YES;
}

这会将链接数据传递给 AppsFlyer Tracker,因此应调用 onAppOpenAttribution

【讨论】:

  • 我已经添加了这个,但它没有被调用,任何想法?
  • 你在设置[AppsFlyerTracker sharedTracker].delegate = self吗?
  • 为什么我会收到此错误“无法将'AppDelegate'类型的值分配给'AppsFlyerTrackerDelegate!'”@poblobart
【解决方案2】:

我不得不这样做:

  1. 重启我的 Xcode

  2. Redownload provisioning profiles

3) 当您点击链接时,请确保您使用的是具有背景 Xcode 项目的真实设备。

  1. 确保 AppsFlyerTracker.shared().delegate = self 在 AppDelegate 文件的 didFinishLaunchingWithOptions 方法中。

【讨论】:

  • 当我添加第 4 个点时,我收到此错误 “无法将 'AppDelegate' 类型的值分配给类型 'AppsFlyerTrackerDelegate!'”
  • 你好 Chetan,请将AppsFlyerTrackerDelegate 添加到类中,如下所示:class AppDelegate: UIResponder, UIApplicationDelegate, AppsFlyerTrackerDelegate {
【解决方案3】:

根据AppsFlyer文档:initializing the SDK,需要检查以下条件:

  • UIApplication.didBecomeActiveNotification 发布或在函数applicationDidBecomeActive(_:) 中调用AppsFlyerTracker.shared.trackAppLaunch()
  • 设置AppsFlyerTracker.shared.isStopTracking = false
  • application(_:continue:restorationHandler:) 中将userActivity 传递给AppsFlyerManager.shared.continue(_) 以获得通用链接(http:// 或 https://)。
  • 将 URL 和选项传递给 AppsFlyerManager.shared.handleOpen(_:options:) in application(_:open:options:) 以获得深层链接(自定义方案)。
  • 将跟踪器委托设置为AppsFlyerTracker.shared.delegate

调用AppsFlyerTracker.shared.trackAppLaunch()后,委托的回调函数onAppOpenAttribution(_ attributionData:)也会传递链接信息。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-12-31
    • 2021-08-01
    • 2016-06-02
    • 1970-01-01
    • 2021-04-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多