These are the changed required to get access to the advertiser identifier in iOS 14:
It requires Xcode 12 and it will only be relevant in a few months from now.
Step 1:
#AdditionalLib: AppTrackingTransparency.framework
#PlistExtra: <key>SKAdNetworkItems</key><array><dict><key>SKAdNetworkIdentifier</key><string>cstr6suwn9.skadnetwork</string></dict></array>
#PlistExtra: <key>NSUserTrackingUsageDescription</key>
#PListExtra: <string>This identifier will be used To deliver personalized ads To you.</string>
Step 2: add:
#if OBJC
#import <AppTrackingTransparency/AppTrackingTransparency.h>
#import <AdSupport/AdSupport.h>
- (void)requestIDFA {
if (@available(iOS 14, *)) {
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
[self.bi raiseUIEvent:nil event:@"gad_trackingauthorization:" params:@[@(status)]];
}];
} else {
[self.bi raiseUIEvent:nil event:@"gad_trackingauthorization:" params:@[@(3)]];
}
}
#End If
Step 3: before loading an ad (required once):
Dim no As NativeObject = Me
no.RunMethod("requestIDFA", Null)
Wait For GAD_TrackingAuthorization (Status As Int)
Status = 3 means that the user allowed your app access to the tracking id. Ads will be displayed even if the user denied access. You don't need to do anything with the status value.