Help Center/Details/

iOS全局配置

注意事项:

  • 由于品牌升级自1.9.7.0版本SDK的前缀WM替换成BU(BytedanceUnion),若SDK需要升级,辛苦接入时统一替换
  • BUAdSDKManager 类是整个 SDK 设置的入口和接口,可以设置 SDK 的一些全局信息,提供类方法获取设置结果。
  • setIsPaidApp:和setUserKeywords:须征得用户同意才可传入。
  • 3400以上版本SDK,任意广告类型均不支持中途更改代理,中途更改代理会导致接收不到广告相关回调,如若存在中途更改代理场景,需自行处理相关逻辑,确保广告相关回调正常执行。

接口说明

目前接口提供以下几个类方法:

@property (nonatomic, copy, readonly, class) NSString *SDKVersion;

/**
 Register the App key that’s already been applied before requesting an ad from TikTok Audience Network.
 @param appID : the unique identifier of the App
 */
+ (void)setAppID:(NSString *)appID;
/**
 Configure development mode.
 @param level : default BUAdSDKLogLevelNone
 */
+ (void)setLoglevel:(BUAdSDKLogLevel)level;

/* Set the COPPA of the user, COPPA is the short of Children's Online Privacy Protection Rule, the interface only works in the United States.
 * @params Coppa 0 adult, 1 child
 */
+ (void)setCoppa:(NSUInteger)Coppa;

/// Set the user's keywords, such as interests and hobbies, etc.
/// Must obtain the consent of the user before incoming.
+ (void)setUserKeywords:(NSString *)keywords;

/// set additional user information.
+ (void)setUserExtData:(NSString *)data;

/// Set whether the app is a paid app, the default is a non-paid app.
/// Must obtain the consent of the user before incoming
+ (void)setIsPaidApp:(BOOL)isPaidApp;

/// Solve the problem when your WKWebview post message empty,default is BUOfflineTypeWebview
+ (void)setOfflineType:(BUOfflineType)type;

///Fields to indicate SDK whether the user grants consent for personalized ads, the value of GDPR : 0 User has granted the consent for personalized ads, SDK will return personalized ads; 1: User doesn't grant consent for personalized ads, SDK will only return non-personalized ads.
+ (void)setGDPR:(NSInteger)GDPR;

/// Custom set the AB vid of the user. Array element type is NSNumber
+ (void)setABVidArray:(NSArray<NSNumber *> *)abvids;

/// Notice that Developers must open GDPR Privacy for the user before setAppID.
+ (void)openGDPRPrivacyFromRootViewController:(UIViewController *)rootViewController confirm:(BUConfirmGDPR)confirm;

/// get appID
+ (NSString *)appID;

/// get isPaidApp
+ (BOOL)isPaidApp;

/// get GDPR
+ (NSInteger)GDPR;

//3600版本开始,新增SDK初始化状态回调
[BUAdSDKManager startWithAsyncCompletionHandler:^(BOOL success, NSError *error) {
   if (success) { /// }
     }];

使用详情

SDK 需要在 AppDelegate 的方法 -
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
里进行初始化

seAppID设置是必须的:

[BUAdSDKManager setAppID:@"xxxxxx"];

更多使用方式可以参见 SDK Demo 工程

日志输出说明

/// Whether to open log. default is none.
[BUAdSDKManager setLoglevel:BUAdSDKLogLevelDebug];

Coppa使用说明

/// Coppa 0 adult, 1 child
[BUAdSDKManager setCoppa:0];

自定义IDFA说明

/**
You can set idfa by yourself, it is optional and maybe will never be used.
*/
[BUAdSDKManager setCustomIDFA:@"12345678-1234-1234-1234-123456789012"];

广告跳过设置

广告接口中的所有rootViewController均为必传项,用来处理广告跳转。SDK里所有的跳转均采用present的方式,请确保传入的rootViewController不能为空且没有present其他的控制器,否则会出现presentedViewController已经存在而导致present失败。

隐私协议

可自定义设置coppa值,用来标识本次广告是否需要遵循儿童在线隐私保护条例。GDPR可以选择
+ (void)openGDPRPrivacyFromRootViewController:(UIViewController *)rootViewController confirm:(BUConfirmGDPR)confirm;
方法来弹出是否遵循隐私协议的选择框。也可自定义设置GDPR,用来标识本次广告是否遵循欧盟通用数据保护条例。

/** 
Custom set the GDPR of the user,GDPR is the short of General Data Protection Regulation,the interface only works in The European.
GDPR 0 close privacy protection, 1 open privacy protection
*/
[BUAdSDKManager setGDPR:0];

夜间模式

3600版本开始,穿山甲支持开发者在使用模板渲染信息流&插屏&Banner广告时设置夜间模式的功能:

BUAdSDKManager 类中

  // 枚举值类型
    typedefNS_ENUM(NSInteger, BUAdSDKThemeStatus) {
      BUAdSDKThemeStatus_Normal = 0,   // 正常模式
      BUAdSDKThemeStatus_Night= 1,     // 夜间模式
      };

      // 若开发者未设置,那么默认值是 Normal, 如果开发者设置的为非法值,会强行修改为  Normal
        + (void)setThemeStatus:(BUAdSDKThemeStatus)themeStatus;

  // 获取当前主题类型
      + (BUAdSDKThemeStatus)themeStatus;
Did the content solve your problem?
Contact us