AppsFlyer iOS 14

AppsFlyer with iOS 14

我正在处理现有项目,之前没有使用过 AppsFlyer。

在旧版本的 AppsFlyer 中,我们在 AppDelegate

中使用这些行对其进行了初始化
    AppsFlyerTracker.shared().appsFlyerDevKey = appsflyerKey
    AppsFlyerTracker.shared().appleAppID = appId

    AppsFlyerTracker.shared().trackAppLaunch()

并使用

跟踪事件
     AppsFlyerTracker.shared().trackEvent("Started", withValues: prop)

但在最新版本的 AppsFlyer 中,初始 class 名称已从

更改
AppsFlyerTracker -> AppsFlyerLib
// now event is logged by
AppsFlyerLib.shared().logEvent("Started", withValues: prop)

所以我有两个问题

  1. 根据iOS 14 中的指南,我们需要在任何跟踪之前添加用户接受它的权限。 它是否也适用于这些 AppsFlyers logEvent 事件

  2. 如果我们需要添加权限那么添加这些行将满足目的 ?

    AppsFlyerLib.shared().waitForATTUserAuthorization(timeoutInterval: 60) ATTrackingManager.requestTrackingAuthorization { (状态)在 }

  3. 我在最新的 AppsFlyerLib[=41] 中没有找到 AppsFlyerTracker.shared().trackAppLaunch() 的替代品=]

如果用户在上面iOS 14 你必须需要添加这些条件

基于您的问题:

  1. As according to guide lines in iOS 14, we need to add permission for user to accept it before any tracking. Is it applies to these AppsFlyers logEvent event too ?

回答:

  1. if we need to add permission then adding these lines will fill the purpose ?

回答:

最初你需要添加框架App Tracking Transparency

// The following block is optional for applications wishing to give users the option to block IDFA collection.
        // for iOS 14 and above - The user may be prompted to block IDFA collection.
        //                        If user opts-out, the IDFA will not be collected by the SDK.
        // for iOS 13 and below - The IDFA will be collected by the SDK. The user will NOT be prompted to block collection.
        if #available(iOS 14, *) {
            // Set a timeout for the SDK to wait for the IDFA collection before handling app launch
            // If timeout expires before user asks to block IDFA collection, the IDFA will be collected.
            AppsFlyerLib.shared().waitForATTUserAuthorization(timeoutInterval: 60)
            // Show the user the Apple IDFA consent dialog (AppTrackingTransparency)
            // MUST be called here before start() in order to prevent IDFA collection by the SDK
            ATTrackingManager.requestTrackingAuthorization { (status) in
            }
        }

上面的completion handler提示了以下两点

  • 将根据用户决定授予或拒绝使用应用程序跟踪权限的结果调用完成处理程序。
  • 如果访问请求授权受到限制,将立即调用完成处理程序。

最后一个问题

I didn't find alternate for AppsFlyerTracker.shared().trackAppLaunch() in the latest AppsFlyerLib

答案:

func applicationDidBecomeActive(_ application: UIApplication) {
        // Start the SDK (start the IDFA timeout set above, for iOS 14 or later)
        if #available(iOS 14, *) {
        AppsFlyerLib.shared().start()
        }else{
            AppsFlyerTracker.shared().trackAppLaunch()
        }
    }

您可以获得AppsFlyer团队提供的sample project