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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容