OK, I have found example case.
If some other dialog is already open, for example dialog for push notification, App Tracking Transparency dialog will not show and status 0 (undetermined) is returned.
Example NON WORKING code (Status = 0):
#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>
Sub Process_Globals
Public App As Application
Public NavControl As NavigationController
Private Page1 As Page
Private xui As XUI
End Sub
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.RootPanel.LoadLayout("Page1")
NavControl.ShowPage(Page1)
App.RegisterUserNotifications(True, False, True)
Dim no As NativeObject = Me
no.RunMethod("requestIDFA", Null)
Wait For GAD_TrackingAuthorization (Status As Int)
Log(Status)
End Sub
Private Sub Page1_Resize(Width As Int, Height As Int)
End Sub
#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
On first run App Tracking Transparency dialog is missing, Status = 0.
On second app start will work as expected.
EDIT:
Thread on Reddit with same problem:
EDIT 2:
As workaround I'm using timer that checks status every 2 seconds. So when user close all dialogs on app start, timer will trigger ATT dialog.
App waiting for review now. I will report review result here.
EDIT 3:
The application is approved. Working code is in post #4.