Objective-C: How to display permission to track in iOS 14.5 and above in Objective-C?

#import <AppTrackingTransparency/AppTrackingTransparency.h>
if (@available(iOS 14, *)) {
// Display permission to track
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
switch(status) {
case ATTrackingManagerAuthorizationStatusNotDetermined :
NSLog(@"Unknown consent");
case ATTrackingManagerAuthorizationStatusRestricted :
NSLog(@"Device has an MDM solution applied");
case ATTrackingManagerAuthorizationStatusDenied :
NSLog(@"Denied consent");
case ATTrackingManagerAuthorizationStatusAuthorized :
NSLog(@"Granted consent");
default :
NSLog(@"Unknown");
}
}];
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Akarsh SEGGEMU

Akarsh SEGGEMU

Software Engineer (Android, iOS, Unity) | M.Sc. Computer Science — Technische Universitaet Berlin | Mobile Advertising, Attribution, Monetisation, UA & Analytic