跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://docs.cloudx.io/llms.txt

Use this file to discover all available pages before exploring further.

CloudX iOS SDK

需要 iOS 13.0+、Xcode 16.0+ 和 Swift 6.0+。

安装

CocoaPods

Podfile
platform :ios, '13.0'

target 'YourApp' do
  use_frameworks!

  # 核心 SDK
  pod 'CloudXCore', '~> 3.2.0'

  # 广告网络适配器(根据需要添加)
  pod 'CloudXMetaAdapter', '~> 3.2.0'       # Meta Audience Network 6.9.0+
  pod 'CloudXVungleAdapter', '~> 3.2.0'     # Vungle SDK 7.4.0+
  pod 'CloudXInMobiAdapter', '~> 3.2.0'     # InMobi SDK 11.0.0+
  pod 'CloudXMintegralAdapter', '~> 3.2.0'  # Mintegral SDK 8.0+
  pod 'CloudXUnityAdsAdapter', '~> 3.2.0'   # Unity Ads SDK 4.17.0+
  pod 'CloudXMagniteAdapter', '~> 3.2.0'    # Magnite SDK 0.0.8+
end
pod install --repo-update

初始化

#import <CloudXCore/CloudXCore.h>

CLXInitializationConfiguration *config =
    [CLXInitializationConfiguration configurationWithAppKey:@"your-app-key-here"];

[[CloudXCore shared] initializeWithConfiguration:config completion:^(CLXSdkConfiguration *sdkConfig, CLXError * _Nullable error) {
    if (sdkConfig) {
        NSLog(@"CloudX SDK 初始化成功");
    } else {
        NSLog(@"CloudX SDK 初始化失败: %@", error.localizedDescription);
    }
}];

广告集成

横幅广告 (320x50)

@interface YourViewController () <CLXBannerDelegate, CLXAdRevenueDelegate>
@property (nonatomic, strong) CLXBannerAdView *bannerAd;
@end

@implementation YourViewController

- (void)createBannerAd {
    self.bannerAd = [[CloudXCore shared] createBannerWithAdUnitId:@"your-banner-ad-unit-id"
                                                   viewController:self];
    self.bannerAd.delegate = self;
    self.bannerAd.revenueDelegate = self;

    if (self.bannerAd) {
        self.bannerAd.translatesAutoresizingMaskIntoConstraints = NO;
        [self.view addSubview:self.bannerAd];

        [NSLayoutConstraint activateConstraints:@[
            [self.bannerAd.bottomAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.bottomAnchor],
            [self.bannerAd.centerXAnchor constraintEqualToAnchor:self.view.centerXAnchor],
            [self.bannerAd.widthAnchor constraintEqualToConstant:320],
            [self.bannerAd.heightAnchor constraintEqualToConstant:50]
        ]];

        [self.bannerAd load];
    }
}

- (void)dealloc {
    [self.bannerAd destroy];
}

#pragma mark - CLXBannerDelegate

- (void)didLoadAd:(CLXAd *)ad {
    NSLog(@"横幅广告从 %@ 加载成功", ad.networkName);
}

- (void)didFailToLoadAd:(NSString *)adUnitId error:(CLXError *)error {
    NSLog(@"横幅广告加载失败: %@", error.localizedDescription);
}

- (void)didClickAd:(CLXAd *)ad {
    NSLog(@"横幅广告被点击");
}

// 可选:当横幅展开时调用(如 MRAID)
- (void)didExpandAd:(CLXAd *)ad {
    NSLog(@"横幅广告已展开");
}

// 可选:当横幅收起时调用
- (void)didCollapseAd:(CLXAd *)ad {
    NSLog(@"横幅广告已收起");
}

#pragma mark - CLXAdRevenueDelegate

- (void)didPayRevenueForAd:(CLXAd *)ad {
    NSLog(@"横幅广告收入: %@ 来自 %@", ad.revenue, ad.networkName);
}

@end
横幅广告默认自动刷新。手动控制刷新:
[self.bannerAd stopAutoRefresh];    // 停止自动刷新
[self.bannerAd load];               // 手动加载新广告
[self.bannerAd startAutoRefresh];   // 重新启用自动刷新
可选的展示位置和自定义数据用于追踪:
self.bannerAd.placement = @"home_screen";
self.bannerAd.customData = @"level:5,coins:100";

MREC 广告 (300x250)

@interface YourViewController () <CLXBannerDelegate, CLXAdRevenueDelegate>
@property (nonatomic, strong) CLXBannerAdView *mrecAd;
@end

@implementation YourViewController

- (void)createMRECAd {
    self.mrecAd = [[CloudXCore shared] createMRECWithAdUnitId:@"your-mrec-ad-unit-id"
                                               viewController:self];
    self.mrecAd.delegate = self;
    self.mrecAd.revenueDelegate = self;

    if (self.mrecAd) {
        self.mrecAd.translatesAutoresizingMaskIntoConstraints = NO;
        [self.view addSubview:self.mrecAd];

        [NSLayoutConstraint activateConstraints:@[
            [self.mrecAd.centerXAnchor constraintEqualToAnchor:self.view.centerXAnchor],
            [self.mrecAd.bottomAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.bottomAnchor constant:-20],
            [self.mrecAd.widthAnchor constraintEqualToConstant:300],
            [self.mrecAd.heightAnchor constraintEqualToConstant:250]
        ]];

        [self.mrecAd load];
    }
}

- (void)dealloc {
    [self.mrecAd destroy];
}

#pragma mark - CLXBannerDelegate

- (void)didLoadAd:(CLXAd *)ad {
    NSLog(@"MREC 广告从 %@ 加载成功", ad.networkName);
}

- (void)didFailToLoadAd:(NSString *)adUnitId error:(CLXError *)error {
    NSLog(@"MREC 广告加载失败: %@", error.localizedDescription);
}

- (void)didClickAd:(CLXAd *)ad {
    NSLog(@"MREC 广告被点击");
}

// 可选:当 MREC 展开时调用(如 MRAID)
- (void)didExpandAd:(CLXAd *)ad {
    NSLog(@"MREC 广告已展开");
}

// 可选:当 MREC 收起时调用
- (void)didCollapseAd:(CLXAd *)ad {
    NSLog(@"MREC 广告已收起");
}

#pragma mark - CLXAdRevenueDelegate

- (void)didPayRevenueForAd:(CLXAd *)ad {
    NSLog(@"MREC 广告收入: %@ 来自 %@", ad.revenue, ad.networkName);
}

@end
MREC 广告也默认自动刷新。使用与横幅广告相同的刷新控制方法。

插屏广告

@interface YourViewController () <CLXInterstitialDelegate, CLXAdRevenueDelegate>
@property (nonatomic, strong) CLXInterstitial *interstitialAd;
@end

@implementation YourViewController

- (void)createInterstitialAd {
    self.interstitialAd = [[CloudXCore shared] createInterstitialWithAdUnitId:@"your-interstitial-ad-unit-id"];
    self.interstitialAd.delegate = self;
    self.interstitialAd.revenueDelegate = self;
    [self.interstitialAd load];
}

- (void)showInterstitialAd {
    if (self.interstitialAd.isReady) {
        // 基本展示
        [self.interstitialAd showFromViewController:self];

        // 或使用可选的展示位置和自定义数据进行追踪
        // [self.interstitialAd showFromViewController:self placement:@"level_complete" customData:@"level:5,score:1000"];
    } else {
        NSLog(@"插屏广告尚未准备好");
    }
}

- (void)dealloc {
    [self.interstitialAd destroy];
}

#pragma mark - CLXInterstitialDelegate

- (void)didLoadAd:(CLXAd *)ad {
    NSLog(@"插屏广告从 %@ 加载成功", ad.networkName);
}

- (void)didFailToLoadAd:(NSString *)adUnitId error:(CLXError *)error {
    NSLog(@"插屏广告加载失败: %@", error.localizedDescription);
}

- (void)didDisplayAd:(CLXAd *)ad {
    NSLog(@"插屏广告已展示");
}

- (void)didFailToDisplayAd:(CLXAd *)ad error:(CLXError *)error {
    NSLog(@"插屏广告展示失败: %@", error.localizedDescription);
}

- (void)didHideAd:(CLXAd *)ad {
    NSLog(@"插屏广告已隐藏");
    [self createInterstitialAd]; // 为下次使用重新加载
}

- (void)didClickAd:(CLXAd *)ad {
    NSLog(@"插屏广告被点击");
}

#pragma mark - CLXAdRevenueDelegate

- (void)didPayRevenueForAd:(CLXAd *)ad {
    NSLog(@"插屏广告收入: %@ 来自 %@", ad.revenue, ad.networkName);
}

@end

激励广告

@interface YourViewController () <CLXRewardedDelegate, CLXAdRevenueDelegate>
@property (nonatomic, strong) CLXRewarded *rewardedAd;
@end

@implementation YourViewController

- (void)createRewardedAd {
    self.rewardedAd = [[CloudXCore shared] createRewardedWithAdUnitId:@"your-rewarded-ad-unit-id"];
    self.rewardedAd.delegate = self;
    self.rewardedAd.revenueDelegate = self;
    [self.rewardedAd load];
}

- (void)showRewardedAd {
    if (self.rewardedAd.isReady) {
        // 基本展示
        [self.rewardedAd showFromViewController:self];

        // 或使用可选的展示位置和自定义数据进行追踪
        // [self.rewardedAd showFromViewController:self placement:@"bonus_coins" customData:@"level:5,coins:100"];
    } else {
        NSLog(@"激励广告尚未准备好");
    }
}

- (void)dealloc {
    [self.rewardedAd destroy];
}

#pragma mark - CLXRewardedDelegate

- (void)didLoadAd:(CLXAd *)ad {
    NSLog(@"激励广告从 %@ 加载成功", ad.networkName);
}

- (void)didFailToLoadAd:(NSString *)adUnitId error:(CLXError *)error {
    NSLog(@"激励广告加载失败: %@", error.localizedDescription);
}

- (void)didDisplayAd:(CLXAd *)ad {
    NSLog(@"激励广告已展示");
}

- (void)didFailToDisplayAd:(CLXAd *)ad error:(CLXError *)error {
    NSLog(@"激励广告展示失败: %@", error.localizedDescription);
}

- (void)didHideAd:(CLXAd *)ad {
    NSLog(@"激励广告已隐藏");
    [self createRewardedAd]; // 为下次使用重新加载
}

- (void)didClickAd:(CLXAd *)ad {
    NSLog(@"激励广告被点击");
}

- (void)didRewardUserForAd:(CLXAd *)ad withReward:(CLXReward *)reward {
    NSLog(@"用户获得奖励: %ld %@", (long)reward.amount, reward.label);
    // 向用户发放奖励
}

#pragma mark - CLXAdRevenueDelegate

- (void)didPayRevenueForAd:(CLXAd *)ad {
    NSLog(@"激励广告收入: %@ 来自 %@", ad.revenue, ad.networkName);
}

@end

原生广告(Reels)

即将推出 — 原生广告尚未正式开放使用。本节仅面向早期集成合作伙伴发布。原生广告 API 在正式发布前可能会发生变更。
原生广告允许您使用自定义 UI 组件(标题、正文、图标、媒体、行动号召)按自己的布局渲染广告素材。配合视频素材和正确的播放设置,原生广告即可成为全屏垂直 “Reels”(与 Instagram Reels 或 TikTok 相同的用户体验)。 一个 Reel 由三部分构成:
  1. 包含视频内容的原生广告。 广告的 mediaView 包含视频播放器,其他素材(标题、正文、图标、CTA)覆盖在视频之上。
  2. 视频播放设置。 加载器上的三个属性分别用于禁用全屏、开启有声播放和隐藏媒体控件。
  3. 全屏分页容器。 启用分页的 UICollectionView 配合垂直流布局,每个单元格即为一个 Reel。

Reels API 概览

功能CloudX API说明
检测视频素材ad.nativeAd.isVideoContent当加载的素材为视频时返回 YES
获取视频时长ad.nativeAd.videoDuration视频时长(秒),未知时为 0
用户关闭广告didCloseNativeAd: 代理回调当用户通过 AdChoices 举报或隐藏广告时触发
禁用全屏loader.disableVideoFullScreen = YES阻止视频在点击时进入全屏模式
有声播放loader.startVideoUnmuted = YES开始播放时开启声音
隐藏媒体控件loader.hideVideoMediaControls = YES隐藏播放/暂停和静音/取消静音控件
原生广告目前需要 Meta Audience Network 适配器(CloudXMetaAdapter)。其他适配器的竞价暂不支持原生广告格式。

要求

  • CloudX iOS SDK 2.3.0+
  • CloudXMetaAdapter 2.3.0+
  • Meta Audience Network SDK 6.21.0+
  • iOS 13.0+

创建加载器并配置视频

@interface YourViewController () <CLXNativeAdDelegate, CLXAdRevenueDelegate>
@property (nonatomic, strong) CLXNativeAdLoader *nativeAdLoader;
@end

@implementation YourViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.nativeAdLoader = [[CloudXCore shared] createNativeAdLoaderWithAdUnitIdentifier:@"your-native-ad-unit-id"];
    self.nativeAdLoader.nativeAdDelegate = self;
    self.nativeAdLoader.revenueDelegate = self;

    self.nativeAdLoader.disableVideoFullScreen = YES;
    self.nativeAdLoader.startVideoUnmuted = YES;
    self.nativeAdLoader.hideVideoMediaControls = YES;
}

- (void)dealloc {
    [self.nativeAdLoader destroy];
}

@end
属性默认值Reels 值说明
disableVideoFullScreenNOYES阻止视频在点击时进入全屏模式
startVideoUnmutedNOYES开始播放时开启声音
hideVideoMediaControlsNOYES隐藏播放/暂停和静音/取消静音控件
在调用 loadAd 之前设置以上属性。对静态图片素材无效。对于 Reels 风格的信息流,将三个属性全部设置为 YES

构建原生广告布局

创建 CLXNativeAdView,使用视图绑定器将自定义子视图映射到素材角色:
- (CLXNativeAdView *)createNativeAdView {
    CLXNativeAdViewBinder *binder = [[CLXNativeAdViewBinder alloc] initWithBuilderBlock:^(CLXNativeAdViewBinderBuilder *builder) {
        builder.titleLabelTag = CLXNativeAdViewTagTitleLabel;
        builder.bodyLabelTag = CLXNativeAdViewTagBodyLabel;
        builder.iconImageViewTag = CLXNativeAdViewTagIconImageView;
        builder.callToActionButtonTag = CLXNativeAdViewTagCallToActionButton;
        builder.mediaContentViewTag = CLXNativeAdViewTagMediaViewContainer;
        builder.optionsContentViewTag = CLXNativeAdViewTagOptionsContentView;
        builder.advertiserLabelTag = CLXNativeAdViewTagAdvertiserLabel;
    }];

    CLXNativeAdView *adView = [[CLXNativeAdView alloc] init];
    [adView bindViewsWithViewBinder:binder];
    return adView;
}
你也可以直接在 CLXNativeAdView 上设置 outlet:
CLXNativeAdView *adView = [[CLXNativeAdView alloc] init];
adView.titleLabel = myTitleLabel;
adView.bodyLabel = myBodyLabel;
adView.iconImageView = myIconImageView;
adView.callToActionButton = myCTAButton;
adView.mediaContentView = myMediaContainer;
adView.optionsContentView = myOptionsContainer;
adView.advertiserLabel = myAdvertiserLabel;

加载广告

流程 A — 加载到预构建的视图中:
CLXNativeAdView *adView = [self createNativeAdView];
[self.nativeAdLoader loadAdIntoAdView:adView];
流程 B — 先加载,稍后渲染(延迟渲染):
[self.nativeAdLoader loadAd];

- (void)didLoadNativeAd:(nullable CLXNativeAdView *)nativeAdView forAd:(CLXAd *)ad {
    CLXNativeAdView *adView = /* 创建广告视图 */;
    [self.nativeAdLoader renderNativeAdView:adView withAd:ad];
    [self.view addSubview:adView];
}

处理回调

#pragma mark - CLXNativeAdDelegate(必选)

- (void)didLoadNativeAd:(nullable CLXNativeAdView *)nativeAdView forAd:(CLXAd *)ad {
    NSLog(@"Native ad loaded from %@", ad.networkName);

    if (ad.nativeAd.isVideoContent) {
        NSLog(@"Video duration: %.1fs", ad.nativeAd.videoDuration);
    }

    if (nativeAdView) {
        [self.view addSubview:nativeAdView];
    }
}

- (void)didFailToLoadNativeAdForAdUnitIdentifier:(NSString *)adUnitId error:(CLXError *)error {
    NSLog(@"Native ad failed to load: %@", error.localizedDescription);
}

- (void)didClickNativeAd:(CLXAd *)ad {
    NSLog(@"Native ad clicked");
}

#pragma mark - CLXNativeAdDelegate(可选)

- (void)didExpireNativeAd:(CLXAd *)ad {
    NSLog(@"Native ad expired — destroy and reload");
    [self.nativeAdLoader destroyAd:ad];
    [self.nativeAdLoader loadAd];
}

- (void)didCloseNativeAd:(CLXAd *)ad {
    NSLog(@"User dismissed the ad via AdChoices");
    [self.nativeAdLoader destroyAd:ad];
}

#pragma mark - CLXAdRevenueDelegate

- (void)didPayRevenueForAd:(CLXAd *)ad {
    NSLog(@"Native ad revenue: %@ from %@", ad.revenue, ad.networkName);
}

清理资源

使用完毕后务必销毁广告:
// 销毁特定已加载的广告
[self.nativeAdLoader destroyAd:ad];

// 销毁加载器及所有关联资源
[self.nativeAdLoader destroy];

原生广告素材(CLXNativeAd)

CLXNativeAd 对象可通过代理回调中的 ad.nativeAd 获取:
属性类型说明
titleNSString?标题文本
bodyNSString?正文/描述文本
callToActionNSString?CTA 按钮文本(如 “Install Now”)
advertiserNSString?广告主名称
iconCLXNativeAdImage?应用图标图片
mainImageCLXNativeAdImage?主图片(静态素材)
mediaViewUIView?视频/媒体播放器视图(由适配器提供)
optionsViewUIView?AdChoices 或选项视图(由适配器提供)
mediaContentAspectRatioCGFloat媒体内容宽高比
starRatingNSNumber?应用商店评分(0–5)
isVideoContentBOOL素材是否为视频
videoDurationNSTimeInterval视频时长(秒),未知时为 0
expiredBOOL广告是否已过期

Reels 信息流使用提示

  • 使用 UICollectionView,设置 pagingEnabled = YES 并配合垂直方向的 UICollectionViewFlowLayout,设置 minimumLineSpacing = 0,每个单元格全屏显示。
  • 在回收单元格时调用 CLXNativeAdViewprepareForReuse
  • 每个广告位创建一个 CLXNativeAdLoader,按顺序加载广告。
  • 不再需要广告时通过 destroyAd: 销毁。

广告信息 (CLXAd)

CLXAd 对象会传递给代理回调,包含已加载/展示广告的信息:
属性类型描述
adFormatCLXAdFormat广告格式(横幅、MREC、插屏、激励)
adUnitIdNSString?广告单元 ID
adUnitNameNSString?广告单元名称
networkNameNSString?获胜广告网络的名称
networkPlacementNSString?网络特定的展示位置 ID
placementNSString?通过 placement 属性设置的自定义展示位置
revenueNSNumber?展示级别收入(美元)
- (void)didLoadAd:(CLXAd *)ad {
    NSLog(@"广告格式: %ld", (long)ad.adFormat);
    NSLog(@"网络: %@", ad.networkName);
    NSLog(@"收入: %@", ad.revenue);
}

错误处理

所有 SDK 错误都作为 CLXError 对象在代理回调中返回:
属性类型描述
codeCLXErrorCode错误类别
localizedDescriptionNSString人类可读的描述
underlyingErrorNSError?可选的底层错误

错误代码类别

范围类别常见代码
0通用CLXErrorCodeInternalError
100-199网络CLXErrorCodeNetworkErrorCLXErrorCodeNetworkTimeoutCLXErrorCodeServerErrorCLXErrorCodeNoConnection
200-299初始化CLXErrorCodeNotInitializedCLXErrorCodeSDKDisabledCLXErrorCodeNoAdaptersFoundCLXErrorCodeInvalidAppKey
300-399广告加载CLXErrorCodeNoFillCLXErrorCodeInvalidAdUnitCLXErrorCodeAdsDisabled
400-499展示CLXErrorCodeAdNotReadyCLXErrorCodeAdAlreadyShowing
600-699适配器CLXErrorCodeAdapterNoFillCLXErrorCodeAdapterTimeoutCLXErrorCodeAdapterLoadTimeoutCLXErrorCodeAdapterInitializationError

高级功能

调试日志

[CloudXCore setMinLogLevel:CLXLogLevelDebug];  // 启用调试日志
[CloudXCore setMinLogLevel:CLXLogLevelNone];   // 禁用所有日志
日志级别: verbose < debug < info < warn < error < none

展示级别收入追踪

在任何广告格式上设置 revenueDelegate 以接收展示级别收入(ILR)回调。CLXAd 对象包含以美元计价的收入值和获胜网络名称。
self.bannerAd.revenueDelegate = self;

- (void)didPayRevenueForAd:(CLXAd *)ad {
    NSLog(@"收入: %@ 来自 %@", ad.revenue, ad.networkName);
}
适用于所有广告格式(横幅、MREC、插屏、激励)。

测试模式

测试模式通过设备白名单进行服务端控制。这提供了更好的安全性和对哪些设备接收测试广告的控制。 启用测试模式:
  1. 初始化 SDK 并检查日志中的设备 IFA:
    [CloudX][INFO] Device IFA for test whitelisting: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
    
  2. 复制 IFA 并将其添加到 CloudX 服务器仪表板的设备白名单中
  3. SDK 将自动为测试模式配置适配器并在竞价请求中包含测试标志
测试模式由服务器确定,因此您不需要在开发和线上版本之间更改任何代码。

隐私合规

CloudX SDK 通过从 NSUserDefaults 读取标准 IAB 隐私字符串来支持 GDPR 和 CCPA 隐私合规。这些值通常由您的同意管理平台(CMP)自动设置,如 Google UMP、OneTrust 或 Sourcepoint。

工作原理

SDK 自动检测用户位置并读取同意信号:
  1. 欧盟用户(GDPR):根据 IAB 全球供应商列表 检查 TCF v2 对目的 1 和 2 的同意和供应商同意(CloudX 供应商 ID:1510
  2. 美国用户(CCPA):检查销售/共享选择退出信号
  3. 其他地区:无限制
当用户拒绝同意或选择退出时,SDK 会从广告请求中移除 PII:
  • 广告标识符(IDFA)被清除
  • 地理坐标(纬度/经度)被移除
  • 用户键值不会发送
  • 哈希用户 ID 被排除

支持的隐私密钥

密钥标准描述
IABGPP_HDR_GppStringGPP全球隐私平台字符串(现代)
IABGPP_GppSIDGPPSection IDs(如 “2” 为欧盟,“7” 为美国国家,“8” 为美国加州)
IABTCF_TCStringTCF v2GDPR 同意字符串(旧版)
IABTCF_gdprAppliesTCF v2GDPR 是否适用(1 = 是,0 = 否)
IABUSPrivacy_StringUS PrivacyCCPA 隐私字符串(旧版,如 “1YNN”)
当两者都可用时,SDK 优先使用 GPP(现代标准)而非旧版 TCF/US Privacy 字符串。

应用追踪透明度(ATT)

在 iOS 14.5+ 上,您必须在 SDK 可以访问 IDFA 之前请求应用追踪透明度授权。在初始化 CloudX SDK 之前请求 ATT 权限:
#import <AppTrackingTransparency/AppTrackingTransparency.h>

if (@available(iOS 14.5, *)) {
    [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
        // 在 ATT 响应后初始化 CloudX SDK
        [self initializeCloudX];
    }];
} else {
    [self initializeCloudX];
}
在 Info.plist 中添加 NSUserTrackingUsageDescription 键,并说明您需要追踪权限的原因。

手动隐私 API

如果您自行管理用户同意(不使用 CMP),可以直接设置 GDPR 和 CCPA 隐私状态。请在初始化 SDK 之前调用这些方法 — 部分广告网络 SDK 要求在初始化时设置隐私参数,初始化后设置的值可能不会生效。
// 在初始化 SDK 之前设置隐私
[CloudXCore setHasUserConsent:@YES];
[CloudXCore setDoNotSell:@NO];

[[CloudXCore shared] initializeWithConfiguration:config completion:completion];
当手动设置值和 CMP 信号同时存在时,CMP 信号(GPP/TCF/US Privacy)优先。手动设置值在未集成 CMP 时作为回退使用。传入 nil 可清除手动设置值,完全使用 CMP。

用户定向

// 设置哈希用户 ID 用于定向
[[CloudXCore shared] setHashedUserID:@"hashed-user-id"];

// 设置自定义用户键值对(受隐私法规清除)
[[CloudXCore shared] setUserKeyValue:@"age" value:@"25"];
[[CloudXCore shared] setUserKeyValue:@"gender" value:@"male"];
[[CloudXCore shared] setUserKeyValue:@"location" value:@"US"];

// 设置自定义应用键值对(不受隐私法规影响)
[[CloudXCore shared] setAppKeyValue:@"app_version" value:@"1.0.0"];
[[CloudXCore shared] setAppKeyValue:@"user_level" value:@"premium"];

// 清除所有自定义键值
[[CloudXCore shared] clearAllKeyValues];

技术支持

如需支持,请联系 mobile@cloudx.io