目前接口提供以下几个类方法:
nonatomic, copy, readonly, class) NSString *SDKVersion; (
//同时集成穿山甲SDK和Pangle SDK需要设置此接口,5205及以上版本该接口下线,开发者不需要设置
nonatomic, assign) BUAdSDKTerritory territory; (
//应用ID
nonatomic, copy) NSString *appID; (
//应用的唯一标识,可选参数
nonatomic, copy) NSString *secretKey; (
//配置开发模式。默认BUAdSDKLogLevelNone
nonatomic, assign) BUAdSDKLogLevel logLevel; (
//用户年龄设置
nonatomic, assign) BUAdSDKAgeGroup ageGroup; (
//用户的其他信息
nonatomic, copy) NSString *userExtData; (
//默认 BUOfflineTypeWebview
nonatomic, assign) BUOfflineType webViewOfflineType; (
//打印调试日志,0关闭调试日志; 1打开调试日志
nonatomic, strong) NSNumber *debugLog; (
//主题模式
nonatomic, strong) NSNumber *themeStatus; (
//自定义设置用户AB实验
nonatomic, strong) NSArray<NSNumber *> *abvids; (
//用户自定义设置AB SDK版本
atomic, copy) NSString *abSDKVersion; (
//自定义idfa
nonatomic, copy) NSString *customIdfa; (
//是否允许SDK在播放音频时修改AVAudioSession的类别和选项,默认为NO。SDK设置的类别是AVAudioSessionCategoryAmbient,开发者可以自行设置为AVAudioSessionCategoryOptionDuckOthers
nonatomic, assign) BOOL allowModifyAudioSessionSetting; (
// BUAudioSessionSettingType_Mix = 3 可以跟其他音乐软件共存声音
// BUAudioSessionSettingType_Default = 0 不支持混音
// 6204及以上版本支持
nonatomic, assign) BUAudioSessionSettingType audioSessionSetType; (
//unity开发者,设置为YES
nonatomic, assign) BOOL unityDeveloper; (
//隐私数据设置,建议不设置该参数
nonatomic, strong) id<BUAdSDKPrivacyProvider> privacyProvider; (
//logo图标设置
nonatomic, strong, nullable) UIImage *appLogoImage; (
//调试模式设置为NO
nonatomic, assign) BOOL SDKDEBUG; (
//3600版本开始,新增SDK初始化状态回调
[BUAdSDKManager startWithAsyncCompletionHandler:^(BOOL success, NSError *error) {
if (success) { /// }
}];
强烈建议在用户同意隐私协议后再进行SDK的初始化操作,其中seAppID设置是必须的
//3500及以上版本SDK初始化说明
xxxxxxxxxx
BUAdSDKConfiguration *configuration = [BUAdSDKConfiguration configuration];
configuration.territory = BUAdSDKTerritory_CN;
configuration.appID = "xxxxxx";//除appid外,其他参数配置按照项目实际需求配置即可。
[BUAdSDKManager startWithAsyncCompletionHandler:^(BOOL success, NSError *error) {
if (success) {
dispatch_async(dispatch_get_main_queue(), ^{
//请求广告逻辑处理
});
}
}];
//3500以下版本SDK初始化说明
xxxxxxxxxx
[BUAdSDKManager setAppID:"xxxxxx"];//57xx版本正式下线
更多使用方式可以参见 SDK Demo 工程
xxxxxxxxxx
// 日志输出枚举值详情
typedef NS_ENUM(NSInteger, BUAdSDKLogLevel) {
BUAdSDKLogLevelNone,
BUAdSDKLogLevelError,
BUAdSDKLogLevelWarning,
BUAdSDKLogLevelInfo,
BUAdSDKLogLevelDebug,
BUAdSDKLogLevelVerbose,
};
3500及以上版本说明
xxxxxxxxxx
BUAdSDKConfiguration *configuration = [BUAdSDKConfiguration configuration];
configuration.logLevel = BUAdSDKLogLevelDebug;
3500以下版本说明
xxxxxxxxxx
/// Whether to open log. default is none.
[BUAdSDKManager setLoglevel:BUAdSDKLogLevelDebug];
3500及以上版本说明
xxxxxxxxxx
BUAdSDKConfiguration *configuration = [BUAdSDKConfiguration configuration];
configuration.customIdfa = "12345678-1234-1234-1234-123456789012"
3500以下版本说明
xxxxxxxxxx
[BUAdSDKManager setCustomIDFA:"12345678-1234-1234-1234-123456789012"];
广告接口中的所有rootViewController均为必传项
,用来处理广告跳转。SDK里所有的跳转均采用present的方式,请确保传入的rootViewController不能为空且没有present其他的控制器,否则会出现presentedViewController已经存在而导致present失败。
xxxxxxxxxx
/// You can use this property to set whether the SDK can use certain privacy data, or pass these privacy data yourself.
/// If this property is not set, the SDK will execute the default privacy data usage logic.
/// Note: This property is only valid for the CN environment. Unless you know what you need, it is recommended not to assign a value to this property.
nonatomic, strong) id<BUAdSDKPrivacyProvider> privacyProvider; (
/// Provide a protocol for custom private data
/// Only valid in the CN environment
BUAdSDKPrivacyProvider <NSObject data-tomark-pass >
/// Specify whether to allow the SDK to use location data
- (BOOL)canUseLocation;
/// Return a latitude value
- (CLLocationDegrees)latitude;
/// Return a longitude value
- (CLLocationDegrees)longitude;
3600版本开始,穿山甲支持开发者在使用模板渲染信息流&插屏&Banner广告时设置夜间模式的功能
xxxxxxxxxx
BUAdSDKManager 或 BUAdSDKConfiguration类中
// 枚举值类型
typedefNS_ENUM(NSInteger, BUAdSDKThemeStatus) {
BUAdSDKThemeStatus_Normal = 0, // 正常模式
BUAdSDKThemeStatus_Night= 1, // 夜间模式
};
// 若开发者未设置,那么默认值是 Normal, 如果开发者设置的为非法值,会强行修改为 Normal
+ (void)setThemeStatus:(BUAdSDKThemeStatus)themeStatus;
// 获取当前主题类型
+ (BUAdSDKThemeStatus)themeStatus;
xxxxxxxxxx
BUAdSDKConfiguration *configuration = [BUAdSDKConfiguration configuration];
configuration.appID = [BUDAdManager appKey];
configuration.privacyProvider = [[BUDPrivacyProvider alloc] init];
configuration.appLogoImage = [UIImage imageNamed:@"AppIcon"];
configuration.debugLog = @(1);
configuration.allowModifyAudioSessionSetting = YES;
//设置这个可以让后台音乐跟广告声音共存
configuration.audioSessionSetType = BUAudioSessionSettingType_Mix; //可以跟其他音乐软件共存声音