iOS 17.4.1 requestTrackingAuthorizationWithCompletionHandler always ATTrackingManagerAuthorizationStatusDenied

In my device (iOS 17.4.1) settings, allowing apps to request tracking is enabled. Here is my request code:

if (@available(iOS 14, *)) {
        ATTrackingManagerAuthorizationStatus attStatus = [ATTrackingManager trackingAuthorizationStatus];
        if(attStatus == ATTrackingManagerAuthorizationStatusNotDetermined){
            [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
                if (status == ATTrackingManagerAuthorizationStatusAuthorized) {
                    NSLog(@"iOS14, ATT enabled");
                    [FBAdSettings setAdvertiserTrackingEnabled:YES];
                    NSLog(@"iOS14, ATT enabled, FBAdSettings setAdvertiserTrackingEnabled:YES successed");
                    
                } else if (status == ATTrackingManagerAuthorizationStatusDenied) {
                    NSLog(@"iOS14, ATT disabled");
                    [FBAdSettings setAdvertiserTrackingEnabled:NO];
                    NSLog(@"iOS14, ATT disabled, FBAdSettings setAdvertiserTrackingEnabled:NO successed");
                }
                UnitySendMessage("StoreKitListener", "OnRequestATTPermissionFinished", [[NSString stringWithFormat:@"%d", (int)status] cStringUsingEncoding:NSUTF8StringEncoding]);
            }];
        }
        
    } else {
        UnitySendMessage("StoreKitListener", "OnRequestATTPermissionFinished", [[NSString stringWithFormat:@"%d", 3] cStringUsingEncoding:NSUTF8StringEncoding]);
    }

When attStatus == ATTrackingManagerAuthorizationStatusNotDetermined, requestTrackingAuthorizationWithCompletionHandler will be called. Afterwards, status == ATTrackingManagerAuthorizationStatusDenied is received, and at the same time, I can see the permission request popup.

I found the solution in this post

iOS 17.4.1 requestTrackingAuthorizationWithCompletionHandler always ATTrackingManagerAuthorizationStatusDenied
 
 
Q