Skip to content

Instantly share code, notes, and snippets.

@Shubham0812
Created September 9, 2021 06:42
Show Gist options
  • Save Shubham0812/e60acf5da3e37e3ae633eb2718415e3b to your computer and use it in GitHub Desktop.
Save Shubham0812/e60acf5da3e37e3ae633eb2718415e3b to your computer and use it in GitHub Desktop.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
self.registerForAppTrackingTransparency(launchOptions)
return true
}
private func registerForAppTrackingTransparency(_ launchOptions: [UIApplication.LaunchOptionsKey: Any]?) {
if #available(iOS 14, *) {
ATTrackingManager.requestTrackingAuthorization { (status) in
if status != .notDetermined && status != .restricted {
if status == .authorized {
print("authorised")
} else if status == .denied {
print("denied")
}
}
}
} else {
/// fallback
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment