解決 iOS 15 上 IDFA 權(quán)限彈窗(App Tracking Transparency)不顯示

在iOS 15正式版發(fā)布后,App提交審核后多次遇到次問題,如何解決?

這里記錄下解決過程

Guideline 2.1 - Information Needed

We're looking forward to completing our review, but we need more information to continue. Your app uses the AppTrackingTransparency framework, but we are unable to locate the App Tracking Transparency permission request when reviewed on iOS 15.0.

Since you indicated in App Store Connect that you collect data in order to track the user, we need to confirm that App Tracking Transparency has been correctly implemented.

在iOS15 斷點(diǎn)調(diào)試,發(fā)現(xiàn)在回調(diào)時(shí)候 ATTrackingManagerAuthorizationStatus 還是 ATTrackingManagerAuthorizationStatusNotDetermined

最開始嘗試多次調(diào)用此方法,發(fā)現(xiàn)居然可以彈出idfa彈窗了!

  if (@available(iOS 14,*)) {
        [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
  // 
        }];
    }

蘋果在Xcode 13 上官方文檔已經(jīng)進(jìn)行了更新,以下是蘋果官方文檔說明

Calls to the API only prompt when the application state is: UIApplicationStateActive. Calls to the API through an app extension do not prompt.

The requestTrackingAuthorizationWithCompletionHandler: is the one-time request to authorize or deny access to app-related data that can be used for tracking the user or the device. The system remembers the user’s choice and doesn’t prompt again unless a user uninstalls and then reinstalls the app on the device.

Xcode 13上 文檔截圖

調(diào)用邏輯

- (void)applicationDidBecomeActive:(UIApplication *)application {
   // 申請(qǐng)權(quán)限代碼 requestAppTrackAuth ;
}

然后經(jīng)過一段時(shí)間發(fā)現(xiàn)大部分情況,將權(quán)限申請(qǐng)放在 ```applicationDidBecomeActive 調(diào)用可以通過審核

其他小概率不通過的,可以嘗試下玄學(xué)延時(shí)方法 或者 進(jìn)行狀態(tài)循環(huán)檢測(cè)

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容