iOS14.5之后,请务必配置NSUserTrackingUsageDescription隐私描述, 否则会出现app闪退,导致审核被拒。
1.在plist文件中 新增Privacy - Tracking Usage Description 该id将用于向您推送个性化广告
2.引入 Adsupport.framework ; appTrackingTransparency.framework
3.在对应的地方引入头文件,一般在appdelegate
4.打开追踪开关,申请权限
#import <AdSupport/ASIdentifierManager.h>
#import <AppTrackingTransparency/AppTrackingTransparency.h>
if (@available(iOS 14, *))
{
//IDFA 未请求权限:00000000-0000-0000-0000-000000000000 请求权限成功后:5AAEB13C-B619-43CF-9568-007B1B186D1F
NSLog(@"IDFA:%@",[[ASIdentifierManager sharedManager] advertisingIdentifier]);
//申请权限
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
NSLog(@"%@",[[ASIdentifierManager sharedManager] advertisingIdentifier]);
}];
}