ATT compliance Flutter(iOS)

To ensure compliance with Apple privacy guidelines and regulations, we don't track data if users don't allow it.

  1. Add NSUserTrackingUsageDescription key and related value in Info.plist.

  2. Present an app-tracking authorization request to the user. The sample codes are:

func requestTrackingPermision() {
    if #available(iOS 14, *) {
        ATTrackingManager.requestTrackingAuthorization { status in
            switch status {
            case .authorized:
                debugPrint("ATT permission authorized")
            case .denied:
                debugPrint("ATT permission denied")
            case .notDetermined:
                debugPrint("ATT permission notDetermined")
            case .restricted:
                debugPrint("ATT permission restricted")
            @unknown default:
                break
            }
        }
    } else {}
}

override func application(
  _ application: UIApplication,
  didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
    FWFlutterSDK.initializeSDK(nil)
    DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
        self.requestTrackingPermision()
    }
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}

For example, the users will see the following pop-up window for the first time.

It's not required to call ATTrackingManager.requestTrackingAuthorization in application(:, didFinishLaunchingWithOptions:) -> Bool

For more details, please refer to the following links:

Last updated