AppsFlyerSDK / appsflyer-flutter-plugin

Flutter Plugin for AppsFlyer SDK
MIT License
142 stars 111 forks source link

Update readme information about configuration tracking at iOS14 #188

Closed istemit closed 4 months ago

istemit commented 2 years ago

Added information how to add request tracking code to AppDelegate.swift Added comment about delay for showing ATT pop-up for iOS 15 (right now App Store rejects apps, because pop-up isn't showing)

fbanyai commented 2 years ago

Hey @istemit ,

Thank you for your hint about this implementation. I'm struggling for days to have my app approved by Apple and I'm pretty confident that with this approach it will finally be accepted. 🤞

Combining with info that I got from other sources (https://stackoverflow.com/a/69510678/414635) I ended up creating the call inside an applicationDidBecomeActive method override, as follows:

.
.
.
import AppTrackingTransparency

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {

  .
  .
  .

  override func applicationDidBecomeActive(_ app: UIApplication) {

    if #available(iOS 14.5, *) {
        // If your app showing pop-up with request for push notifications, you need to set delay for 1 second before showing ATT pop-up
        DispatchQueue.main.asyncAfter(deadline: .now() + 1, execute: {
            ATTrackingManager.requestTrackingAuthorization { _ in }
        })
    }

  }
}

Now the window is being showed everytime I install the app, right after I open it. Before that, only by using the recommended app_tracking_transparency package instructions, it was very inconsistent.