AdjustDMA

Adjust的文档

https://help.adjust.com/zh/article/privacy-features-ios-sdk#provide-consent-data-to-google-digital-markets-act-compliance

pod

pod 'Adjust'
pod 'Google-Mobile-Ads-SDK'

code

#import <Adjust/Adjust.h>
#import <UserMessagingPlatform/UserMessagingPlatform.h>

//在Max广告SDK初始化完成的回调里写adjust到初始化和DMA的处理
[sdk initializeSdkWithCompletionHandler:^(ALSdkConfiguration * _Nonnull configuration) {
    //加载广告的代码省略

    //初始化Adjust
    NSString* adjustToken = @"xxx";
    NSString *adjustEnvironment = ADJEnvironmentProduction;
    ADJConfig* adjustConfig = [ADJConfig configWithAppToken:adjustToken environment:adjustEnvironment];
    [Adjust appDidLaunch:adjustConfig];
    
    //DMA
    ADJThirdPartySharing *adjustThirdPartySharing = [[ADJThirdPartySharing alloc] initWithIsEnabledNumberBool:nil];
    if ([configuration consentFlowUserGeography] == ALConsentFlowUserGeographyGDPR) {
        [adjustThirdPartySharing addGranularOption:@"google_dma" key:@"eea" value:@"1"];
    } else {
        [adjustThirdPartySharing addGranularOption:@"google_dma" key:@"eea" value:@"0"];
    }
    if (UMPConsentInformation.sharedInstance.canRequestAds) {
        [adjustThirdPartySharing addGranularOption:@"google_dma" key:@"ad_personalization" value:@"1"];
        [adjustThirdPartySharing addGranularOption:@"google_dma" key:@"ad_user_data" value:@"1"];
    } else {
        [adjustThirdPartySharing addGranularOption:@"google_dma" key:@"ad_personalization" value:@"0"];
        [adjustThirdPartySharing addGranularOption:@"google_dma" key:@"ad_user_data" value:@"0"];
    }
    [Adjust trackThirdPartySharing:adjustThirdPartySharing];
}];

我的疑惑

经过测试发现:

如果不是GDPR地区,UMPConsentInformation.sharedInstance.canRequestAds始终为假。

如果是GDPR地区,UMPConsentInformation.sharedInstance.canRequestAds始终为真。

如果是GDPR地区,会弹出特定的弹窗,在那个页面不管选择直接同意,还是去权限列表把每个权限挨个关掉,都不影响UMPConsentInformation.sharedInstance.canRequestAds的结果。