iOS15 IDFA权限位置调整

IDFA获取位置,需要从didFinishLaunchingWithOptions获取位置,迁移到applicationDidBecomeActive

  - (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
if (@available(iOS 14, *)) {
   ATTrackingManagerAuthorizationStatus status = ATTrackingManager.trackingAuthorizationStatus;
            switch (status) {
                case ATTrackingManagerAuthorizationStatusDenied:
                    //用户拒绝IDFA
                    break;
                case ATTrackingManagerAuthorizationStatusAuthorized:{
                    //用户允许IDFA
                    if (status == ATTrackingManagerAuthorizationStatusAuthorized) {
                        NSString *idfaString = [[ASIdentifierManager sharedManager] advertisingIdentifier].UUIDString;
                        NSLog(@"%@",idfaString);
                    }
                }
                    break;
                case ATTrackingManagerAuthorizationStatusNotDetermined: {
                    //用户未做选择或未弹窗IDFA
                    //请求弹出用户授权框,只会在程序运行是弹框1次,除非卸载app重装,通地图、相机等权限弹框一样
                    [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
                        if (status == ATTrackingManagerAuthorizationStatusAuthorized) {
                          // 你的操作
                        }

                    }];
                }
                    break;
                default:
                    break;
            }
        } else {
            // Fallback on earlier versions
           if ([ASIdentifierManager.sharedManager isAdvertisingTrackingEnabled]) {
               NSLog(@"用户开启了广告追踪IDFA");
           }else {
              NSLog(@"用户关闭了广告追踪IDFA");
           }
        }
}}

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.2.

Next Steps

Please explain where we can find the App Tracking Transparency permission request in your app. The request should appear before any data is collected that could be used to track the user.

If you've implemented App Tracking Transparency but the permission request is not appearing on devices running the latest OS, please review the available documentation and confirm App Tracking Transparency has been correctly implemented.

If your app does not track users, update your app privacy information in App Store Connect to undeclare tracking. You must have the Account Holder or Admin role to update app privacy information.

Resources

  • Tracking is linking data collected from your app with third-party data for advertising purposes, or sharing the collected data with a data broker. Learn more about tracking.
  • See Frequently Asked Questions about the new requirements for apps that track users.
  • Review developer documentation for App Tracking Transparency.

你可能感兴趣的:(iOS15 IDFA权限位置调整)