You've been noticed! App Tracking Transparency (ATT) for iOS 14.5

IOS 14.5 was recently released, and a little earlier Apple warned developers that starting with this version of the OS, it is necessary to support the AppTrackingTransparency framework, which allows you to access IDFA.





IDFA (The Device Identifier For Advertisers)โ€Š โ€” โ€Š , . . .





, , :





Zeroed out IDFA: 00000000-0000-0000-0000-000000000000





Apple AppTrackingTransparency, 26 , . , .





?

AppsFlyer, 40 % IDFA. , , , .





Apple: https://developer.apple.com/design/human-interface-guidelines/ios/app-architecture/accessing-user-data/





Facebook Instagram , , , .





, . , , ; Win-win, . , IDFA.





, , . . , .





AppTrackingTransparency . info.plist :





<key>NSUserTrackingUsageDescription</key>
<string>      ?   ,           .</string>
      
      



, !





. iOS 14.5, , .





private func requestTrackingAuthorization() {
    guard #available(iOS 14, *) else { return }
    ATTrackingManager.requestTrackingAuthorization { _ in
        DispatchQueue.main.async { [weak self] in
            // self?.router.close() or nothing to do
        }
    }
}
      
      



didFinishLaunchingWithOptions.





import AppTrackingTransparency
      
      



. .





, , . AuthorizationStatus, requestTrackingAuthorization.





private func requestTrackingAuthorization() {
    guard #available(iOS 14, *) else { return }
    ATTrackingManager.requestTrackingAuthorization { status in
        DispatchQueue.main.async {
            switch status {
            case .authorized:
                let idfa = ASIdentifierManager.shared().advertisingIdentifier
                print("  . IDFA: ", idfa)
            case .denied, .restricted:
                print("  .")
            case .notDetermined:
                print("      .")
            @unknown default:
                break
            }
        }
    }
}
      
      



  • requestTrackingAuthorization(completionHandler:) .notDetermined. .





  • , . , UI.





, , .denied .restricted. , , IDFA, , . , :





func goToAppSettings() {
    guard let url = URL(string: UIApplication.openSettingsURLString),
          UIApplication.shared.canOpenURL(url)
    else {
        return
    }
    UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
      
      



. ATT? !








All Articles