OpenSet IOS SDK接入文档


注意

  1. SDK最低支持iOS 11.0
  2. SDK最低编译环境 Xcode 12.0 +

导入

OSET.framework和第三方依赖SDK 到工程下.

将下列SDK拖入到工程中,同时对应.bundle资源文件也添加到工程(SDK demo中提供)

Frameworks:

  • OSETSDK.xcframework

  • OSETSDK.bundle

  • BUAdSDK.framework
    BURelyFoundation.framework
    CSJMediation.framework
    CSJAdSDK.bundle
    (可 pod 见demo的Podfile文件内 )

  • BeiZiSDK.framework
    BeiZiFoundation.framework
    (可 pod 见demo的Podfile文件内 )

  • GDTMobSDK
    (可 pod 见demo的Podfile文件内 )

  • WindSDK.framework
    WindFoundation.framework
    Sigmob.bundle
    (可 pod 见demo的Podfile文件内 )

  • KSAdSDK.framework (Embed设置为'Embed & Sign')
    KSAdSDK.bundle
    (可pod配置,手动导入KSAdSDK.framework后 path指向 KSAdSDK.podspec文件路径 pod 'KSAdSDK', :path => './xxxx/Frameworks')

  • BaiduMobAdSDK.framework
    baidumobadsdk.bundle
    (可 pod 见demo的Podfile文件内 )

  • OctAdSDK.bundle
    OctAdSDK.xcframework
    OctCore.bundle
    OctCore.xcframework
    (可 pod 见demo的Podfile文件内 )

  • TNXASDK.framework
    TanxSDK.framework (可 pod 见demo的Podfile文件内 )

  • JADYun.xcframework
    JADYun.bundle
    (可 pod 见demo的Podfile文件内 )

添加依赖

添加必要系统依赖库以及工程配置如可用pod的全部使用pod引入成功 则无需额外依赖配置(info)

在工程 Target Setting -> Build Phases -> Link Binary With Libraries 中进行添加

  • SafariServices.framework
  • CFNetwork.framework
  • AppTrackingTransparency
  • AVFoundation.framework
  • WebKit.framework
  • StoreKit.framework
  • Security.framework
  • CoreTelephony.framework
  • SystemConfiguration.framework
  • QuartzCore.framework
  • CoreLocation.framework
  • AdSupport.framework
  • Accelerate.framework
  • ImageIO.framework
  • CoreMotion.framework
  • CoreMedia.framework
  • MediaPlayer.framework
  • MobileCoreServices.framework
  • MessageUI.framework
  • libxml2.tbd
  • libz.tbd
  • libsqlite3.tbd
  • libc++.tbd
  • libresolv.9.tbd
  • libxml2.2.tbd
  • libiconv.tbd
  • libbz2.1.0.tbd
  • libbz2.tbd
  • libz.1.2.5.tbd
  • libc++abi.tbd
  • AudioToolbox.framework
  • CoreGraphics.framework
  • DeviceCheck.framework
  • CoreImage.framework
  • CoreML.framework
  • CoreText.framework
  • JavaScriptCore.framework
  • MapKit.framework
  • Photos.framework
  • AssetsLibrary.framework
  • CoreServices.framework

(支持混编)Objective-C 集成

新建Swift File,创建完成后提示是否创建桥接文件,选择Create Bridging Header

(支持混编)Swift 集成

新建桥接文件头文件并配置 Build Settings -> Bridging Header

修改配置及Info.plist

1. Build Settings中Other Linker Flags 增加参数-ObjC、-l"c++"、 -l"c++abi" 、-l"sqlite3"、-l"z"。

  • 如需SDK在Swift开发语言中使用,导入OSETSDK-Bridge-Header.h文件。并且设置桥接路径,Build Settings -> object-c Bridging header,把Header路径拖进去即可. 如需支持bitcode,请联系开发人员。

2. 设置允许Http连接,在工程的 Info.plist 文件中,设置 App Transport Security Settings

选项下 Allow Arbitrary Loads 值为 YES,对应 plist 内容为:

<key>NSAppTransportSecurity</key> 
<dict> 
    <key>NSAllowsArbitraryLoads</key> 
    <true/> 
</dict>

3. 在您的应用的Info.plist文件中,添加一个字符串SKAdNetworkItems键,如

 <key>SKAdNetworkItems</key>
    <array>
        <dict>
            <key>SKAdNetworkIdentifier</key>
            <string>58922NB4GD.skadnetwork</string>
	</dict>
	<dict>
	    <key>SKAdNetworkIdentifier</key>
	    <string>238da6jt44.skadnetwork</string>
	</dict>
	<dict>
		<key>SKAdNetworkIdentifier</key>
		<string>r3y5dwb26t.skadnetwork</string>
	</dict>
	<dict>
		<key>SKAdNetworkIdentifier</key>
		<string>f7s53z58qe.skadnetwork</string>
	</dict>
	<dict>
		<key>SKAdNetworkIdentifier</key>
		<string>x2jnk7ly8j.skadnetwork</string>
	</dict>
	<dict>
		<key>SKAdNetworkIdentifier</key>
		<string>cstr6suwn9.skadnetwork</string>
	</dict>
	<dict>
            <key>SKAdNetworkIdentifier</key>
            <string>22mmun2rn5.skadnetwork</string>
	</dict>
	<dict>
	        <key>SKAdNetworkIdentifier</key>
	        <string>27a282f54n.skadnetwork</string>
	</dict>
</array> 

3.1 (可选配置,添加可增加收益)在您的应用的Info.plist文件中,添加一个数组LSApplicationQueriesSchemes键,如

 <key>LSApplicationQueriesSchemes</key> <array>
<string>tbopen</string> <string>openapp.jdmobile</string> <string>alipays</string> <string>imeituan</string> <string>pddopen</string> <string>sinaweibo</string> <string>snssdk1128</string> <string>kwai</string> <string>ksnebula</string> <string>ctrip</string> <string>vipshop</string> <string>OneTravel</string> <string>taobaoliveshare</string> <string>taobaolite</string> <string>iqiyi</string> <string>eleme</string> <string>openjdlite</string> <string>xhsdiscover</string> <string>tmall</string> <string>dianping</string> <string>youku</string> <string>fleamarket</string> <string>bilibili</string> <string>freereader</string> <string>tantanapp</string> <string>suning</string> <string>qunariphone</string> <string>lianjia</string> <string>zhihu</string> <string>weixin</string> <string>travelguide</string> <string>wbmain</string> <string>taobaotravel</string> <string>cainiao</string> <string>kaola</string> <string>bitauto.yicheapp</string> <string>lianjiabeike</string> <string>taoumaimai</string> <string>amapuri</string> <string>openanjuke</string>
<string>bosszp</string> <string>txvideo</string> <string>mttbrowser</string> <string>momochat</string> <string>baiduboxlite</string> <string>com.360buy.jdpingou</string> <string>vmall</string> <string>tuhu</string> <string>comjia</string> <string>yymobile</string> <string>shuqireader</string>
</array>

4. 支持苹果 ATT:从 iOS 14 开始,若开发者设置 App Tracking Transparency 向用户申请跟踪授权,在用户授权之前IDFA 将不可用。

如果用户拒绝此请求,应用获取到的 IDFA 将自动清零,可能会导致您的广告收入的降低 要获取 App Tracking Transparency 权限,请更新您的 Info.plist,添加 NSUserTrackingUsageDescription 字段和自定义文案描述。

代码示例:

 <key>NSUserTrackingUsageDescription</key>
<string>该标识符将用于向您投放个性化广告</string>

} 

5. 展示授权弹窗需要调用requestTrackingAuthorizationWithCompletionHandler:方法。

我们建议流量等待方法回调完成后处理广告相关逻辑,这样如果用户授权使用IDFA信息, SDK可以使用IDFA进行广告请求。

代码如下

 注 :**********  获取广告追踪,展示授权弹窗,否则审核可能被拒   ********

 //   适配ios15  
 //  ios15获取广告追踪权限要写在 AppDelegate 里的 applicationDidBecomeActive 否则ios15 不弹框可能会被拒
 
 
Objective-C 代码示例
#import <AppTrackingTransparency/AppTrackingTransparency.h>
#import <AdSupport/AdSupport.h>
- (void)requestIDFA {
  [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
    // Tracking authorization completed. Start loading ads here.
  }];
}
Swift 代码示例
import AppTrackingTransparency
import AdSupport
func requestIDFA() {
  ATTrackingManager.requestTrackingAuthorization(completionHandler: { status in
    // Tracking authorization completed. Start loading ads here.
  })
} 

6. 移除模拟器架构

打包上传报错 类似 ITMS-90087 包含 i386 x86_64 打包上架需要移除模拟器架构 i386 x86_64 具体移除方法请参考 https://stackoverflow.com/questions/30547283/submit-to-app-store-issues-unsupported-architecture-x86

例:
查看SDK架构
先CD到目录下 lipo -info xxxxx 例 lipo -info OSETSDK

移除模拟器架构 lipo -remove x86_64 KsAdSDK -o KsAdSDK
lipo -remove i386 KsAdSDK -o KsAdSDK

然后再次查看SDK架构

Xcode12报错提示 Building for iOS Simulator, but the linked and embedded framework 'KSAdSDK.framework' was built for iOS + iOS Simulator.
在Build Settings中将validate workspace改YES

7. SDK测试id

ios测试_appkey31DC084BB6B04838
ios测试_广告类型ios测试_广告位ID
ios测试_短剧内容A0736045CDDF718C13DFF187254EA1D0
ios测试_视频内容E06C7BB2C34605B4CD777EFD590DD4BE
ios测试_互动悬浮4224443B309508BE30C3B8AC7CDE87C1
ios测试_drawC773D52F59FF5AA418CD9E2181327197
ios测试_信息流3DC16BFC019545395507ED826899B16E
ios测试_原生921DE1BF1B3F06838AE04233A42B01F1
ios测试_全屏8FCB39267CE40245B87EF8835A853708
ios测试_激励E80DABEF5FD288492D4A9D05BF84E417
ios测试_插屏351C1A89F8AE79DF62C1B1165A5EAFCC
ios测试_banner7B2BD37383E008B422C93486EACEA11D
ios测试_开屏18666EAA65EC1969E90E982DCA2CB2DD

测试id不验证Bundle identifier(OSETXMAd除外)


其他广告类型详细请参考Demo 

SDK初始化

+ (instancetype)shareInstance;

/**
SDK初始化
 
 @param publicId 媒体Id(appkey)
 */
+ (void)configure:(NSString *)publicId;

/// 获取聚合SDK版本号
+ (NSString *)version;

/// 打开本地日志模式
+ (void)openDebugLog;
/**
 SDK配置日志 用户唯一标识符 推荐设置
 
 @param uid  用户唯一标识符 。userid,手机号,加密字符串等。 此ID仅用于log日志追踪 
 */
+ (void)configureLogsWithUid:(NSString *)uid; 
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    
    [OSETManager configure:@"媒体ID"];
    
    [OSETManager openDebugLog]; //打开日志模式(默认关闭)
    
    return YES;
}

接入广告

Banner广告

@interface BannerViewController ()<OSETBannerAdDelegate>

@property (nonatomic,strong) OSETBannerAd *bannerAd;

@end

@implementation BannerViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    self.bannerAd = [[OSETBannerAd alloc] initWithSlotId:self.slotId rootViewController:self containView:self.view rect:CGRectMake(0, 88, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.width*90/600)];
    self.bannerAd.delegate = self;
    [self.bannerAd loadAdData];
}

插屏广告

 @interface InsertViewController ()<OSETInterstitialAdDelegate>

@property (nonatomic,strong) OSETInterstitialAd *interstitialAd;

@end

@implementation InsertViewController


- (void)viewDidLoad {
    [super viewDidLoad];
     self.interstitialAd = [[OSETInterstitialAd alloc] initWithSlotId:self.slotId];
    self.interstitialAd.delegate = self;
	// userId可传空字符串 调用loadInterstitialAdData 广告加载完成会走DidReceiveSuccess 但是不会展示
    [self.interstitialAd loadInterstitialAdData];
} 

- (void)interstitialDidReceiveSuccess:(nonnull id)interstitialAd slotId:(nonnull NSString *)slotId {
    NSLog(@"oset加载成功");
    //加载成功后展示广告
    [self.interstitialAd showInterstitialFromRootViewController:self.navigationController];
}

开屏广告

@interface SplashViewController ()<OSETSplashAdDelegate>

@property (nonatomic,strong) OSETSplashAd *splashAd;

@end

@implementation SplashViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    UIWindow *window = [UIApplication sharedApplication].keyWindow;
    self.splashAd = [[OSETSplashAd alloc] initWithSlotId:self.slotId window:window bottomView:[UIView new]];
    self.splashAd.delegate = self;
    [self.splashAd loadSplashAd];
} 
- (void)splashDidReceiveSuccess:(nonnull id)splashAd slotId:(nonnull NSString *)slotId {
    NSLog(@"osetsplashDidReceiveSuccess加载成功");
    [self.splashAd showSplashAd];
}

激励视频广告

 @interface RewardVideoViewController ()<OSETRewardVideoAdDelegate>

@property (nonatomic,strong)  OSETRewardVideoAd *rewardVideoAd;

@end

@implementation RewardVideoViewController


- (void)viewDidLoad {
    [super viewDidLoad]
	//激励视频初始化 
   self.rewardVideoAd = [[OSETRewardVideoAd alloc] initWithSlotId:self.slotId  withUserId:@"123"];
    self.rewardVideoAd.delegate = self;
    // userId可传空字符串 调用loadAdData 广告加载完成会走rewardVideoDidReceiveSuccess 但是不会展示
    //[self.rewardVideoAd loadRewardAdData];

	// 具体回调参考demo
} 


- (void)rewardVideoDidReceiveSuccess:(nonnull id)rewardVideoAd slotId:(nonnull NSString *)slotId {
    NSLog(@"oset-osetrewardVideoDidReceiveSuccess加载成功");
    [self.rewardVideoAd loadRewardAdData];
}

全屏视频广告

@interface FullScreebViewController ()<OSETFullscreenVideoAdDelegate>

@property (nonatomic,strong) OSETFullscreenVideoAd *fullscreenVideoAd;

@end

@implementation FullScreebViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.fullscreenVideoAd = [[OSETFullscreenVideoAd alloc] initWithSlotId:self.slotId];
    self.fullscreenVideoAd.delegate = self;
    [self.fullscreenVideoAd loadAdData];
}

原生广告

@interface NativeViewController ()<OSETNativeAdDelegate>

@property (nonatomic,strong) OSETNativeAd *nativeAd;

@end

@implementation NativeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //size高度传入0会自适应高度,并在回调中返回广告View,直接添加到需要展示的位置即可(详细使用参考Demo)
    self.nativeAd = [[OSETNativeAd alloc] initWithSlotId:@"广告位ID" size:CGSizeMake([UIScreen mainScreen].bounds.size.width, 0)];
    self.nativeAd.delegate = self;
    [self.nativeAd loadAdData:3];
}

原生Draw Video广告

@interface NativeViewController ()<OSETNativeAdDelegate>

@property (nonatomic,strong) OSETDrawAd *draw_nativeAd;

@end

@implementation NativeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //size高度传入0会自适应高度,并在回调中返回广告View,直接添加到需要展示的位置即可(详细使用参考Demo)
    self.draw_nativeAd = [[OSETDrawAd alloc] initWithSlotId:@"广告位ID" size:CGSizeMake([UIScreen mainScreen].bounds.size.width, 0)];
    self.draw_nativeAd.delegate = self;
    [self.draw_nativeAd loadAdData:3];

}

接入内容(快手视频内容)

@interface ContentSmallViewController ()

@property (nonatomic,strong) OSETFullContentAd *smallContentAd;

@end

@implementation ContentSmallViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.smallContentAd = [[OSETFullContentAd alloc] initWithSlotId:@"广告位ID" type:OSETContentTypeFeed];

    // Do any additional setup after loading the view.
}

接入咨询内容(快手视频、信息流)

- @interface NewsViewController ()

@property (nonatomic,strong) OSETConsult *consultAd;

@end

@implementation NewsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
 self.consultAd = [[OSETConsult alloc] initWithSlotId:@"908FD9663CDD3817B3F0F22B2DCA0277"
                                            showAdsCount:6
                                              timeLength:30
                                  withInterstitialSlotId:@"A7A86C33868F691D315ADF349F227CCC"
                                        withBannerSlotId:@"EEFC4E97569AFD990BF82C5901AED363"];
    // Do any additional setup after loading the view.
}

- (void)showAd {
    [self.consultAd showFromRootViewController:self];
}

星座运势

-@interface ConstellatoryViewController ()<OSETConstellatoryAdDelegate>
@property(nonatomic,strong)OSETConstellatoryAd * constellatoryAd;
@end

@implementation ConstellatoryViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"星座运势";
    self.constellatoryAd = [[OSETConstellatoryAd alloc] initWithRewardVideoSlotId:@"DF5811FB3CB112C2D41C0E3EDD81C4C7"
                                                           withInterstitialSlotId:@"4FD8476AE54A3DBA39CCD635BBD48957"
                                                                 withBannerSlotId:@"58A0BB27A707FD48ECACF89B0E8A9657"];
    
    self.constellatoryAd.delegate = self;
    // Do any additional setup after loading the view.
}
/// 星座激励视频关闭
- (void)OSETConstellatoryRewardVideoDidClose:(id)rewardVideoAd checkString:(NSString *)checkString{
    NSLog(@"ConstellatoryViewController --- rewardVideoDidClose ");
}
-(void)showAd{
    [self.constellatoryAd showFromRootViewController:self];
}

转盘抽奖

 @interface LuckyDrawViewController ()<OSETDialAdDelegate>
@property (nonatomic,strong) OSETDialAd *consultAd;


@end

@implementation LuckyDrawViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
       self.title = @"幸运抽奖";
       self.consultAd = [[OSETDialAd alloc] initWithRewardVideoSlotId:@"971D11E82E1009B5CAA2D00EFBC4E372"
                                               withInterstitialSlotId:@"4FD8476AE54A3DBA39CCD635BBD48957"
                                                     withBannerSlotId:@"58A0BB27A707FD48ECACF89B0E8A9657"
                                                       withAwardsName:@"大大大奖"
                                                       withAwardsOdds:30//中大奖的概率
                                                      withDefaultName:@"小小小奖"
                                                       withLotteryNum:1
                                                    withLotteryMaxNum:3];
    self.consultAd.delegate = self;
    [self.consultAd showFromRootViewController:self];

    // Do any additional setup after loading the view.
}
-(void)showAd{
    [self.consultAd showFromRootViewController:self];
}

-(void)OSETDialAwardsCompleteWithIsAwards:(BOOL)isAwards{
    if (isAwards) {
        NSLog(@"LuckyDrawViewController -- 中了Awards奖项");
    }else{
        NSLog(@"LuckyDrawViewController -- 中了Default奖项");
    }
} 

接入夺宝

 @interface LootTreasureViewController ()<OSETLootRewardVideoAdDelegate>
@property (nonatomic,strong)  OSETLootTreasureAd* luckAd;


@end
@implementation LootTreasureViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    
  self.navigationItem.title = @"视频夺宝";
     self.luckAd = [[OSETLootTreasureAd alloc]initWithSlotId:@"971D11E82E1009B5CAA2D00EFBC4E372"
                                   withInterstitialSlotId:@"4FD8476AE54A3DBA39CCD635BBD48957"
                                         withBannerSlotId:@"58A0BB27A707FD48ECACF89B0E8A9657"
                                            withAppUserId:@"123"];
     self.luckAd.delegate = self;
     [self.luckAd showFromRootViewController:self];
    // Do any additional setup after loading the view.
}
- (void)OSETRewardVideoDidReceiveSuccess:(id)rewardVideoAd slotId:(NSString *)slotId{
    NSLog(@"OSETRewardVideoDidReceiveSuccess");
}

/// 激励视频加载失败
- (void)OSETRewardVideoLoadToFailed:(id)rewardVideoAd error:(NSError *)error{
    NSLog(@"激励视频加载失败 ==%@",error);
}

/// 激励视频点击
- (void)OSETRewardVideoDidClick:(id)rewardVideoAd{
    NSLog(@"激励视频点击");
}

/// 激励视频关闭
- (void)OSETRewardVideoDidClose:(id)rewardVideoAd checkString:(NSString *)checkString{
    NSLog(@"激励视频关闭");
}

//激励视频播放出错
- (void)OSETRewardVideoPlayError:(id)rewardVideoAd error:(NSError *)error{
    NSLog(@"激励视频播放出错");
}

//激励视频播放结束
- (void)OSETRewardVideoPlayEnd:(id)rewardVideoAd  checkString:(NSString *)checkString{
    NSLog(@"激励视频播放结束");
}
//激励视频开始播放
- (void)OSETRewardVideoPlayStart:(id)rewardVideoAd{
    NSLog(@"激励视频开始播放");
}
//激励视频奖励
- (void)OSETRewardVideoOnReward:(id)rewardVideoAd checkString:(NSString *)checkString{
    NSLog(@"激励视频奖励");
} 

接入任务墙

 @interface IntegralWallViewController ()<OSETLootRewardVideoAdDelegate>
@property(nonatomic,strong)OSETIntegralWallAd * integralAd;
@end
@implementation IntegralWallViewController
- (void)viewDidLoad {
    [super viewDidLoad];
	self.title = @"任务墙";
    self.integralAd = [[OSETIntegralWallAd alloc]initWithAppUserId:@"123"
                                                        withAppKey:@"142792798"
                                                     withIBXAppKey:@"142793166"
                                                     withSecretKey:@"291d28a7be9de4ef"
                                                  withBannerSlotId:@"58A0BB27A707FD48ECACF89B0E8A9657"
                                            withInterstitialSlotId:@"4FD8476AE54A3DBA39CCD635BBD48957"
                                                  withNativeSlotId:@"0BA47216E326C31D9DD2D2923D62D9BC"];
    [self.integralAd showFromRootViewController:self];
    // Do any additional setup after loading the view.
} 

接入Web转盘

 @interface WebDialViewController ()<OSETWebDialAdDelegate>
@property (nonatomic,strong)  OSETWebDialAd* luckAd;


@end

@implementation WebDialViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.luckAd = [[OSETWebDialAd alloc] initWithSlotId:@"971D11E82E1009B5CAA2D00EFBC4E372"
                                 withInterstitialSlotId:@"4FD8476AE54A3DBA39CCD635BBD48957"
                                       withBannerSlotId:@"58A0BB27A707FD48ECACF89B0E8A9657"
                                          withAppUserId:@"123"];
    self.luckAd.delegate = self;
    [self.luckAd showFromRootViewController:self];
    // Do any additional setup after loading the view.
} 

周公解梦

 @interface CrazyDreamViewController ()<OSETCrazyDreamAdRewardVideoDelegate>
@property (nonatomic,strong)  OSETCrazyDreamAd* crazyDream;

@end

@implementation CrazyDreamViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.crazyDream = [[OSETCrazyDreamAd alloc]initWithSlotId:@"971D11E82E1009B5CAA2D00EFBC4E372"
                                             withBannerSlotId:@"58A0BB27A707FD48ECACF89B0E8A9657"
                                                withAppUserId:@"123"];
    self.crazyDream.delegate = self;
    [self.crazyDream showFromRootViewController:self];
    
    // Do any additional setup after loading the view.
} 

老黄历

 @interface CalendarViewController ()<OSETCalendarAdRewardVideoDelegate>
@property(nonatomic,strong)OSETCalendarAd * calendarAd;
@end

@implementation CalendarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.calendarAd  = [[OSETCalendarAd alloc]initWithSlotId:@"971D11E82E1009B5CAA2D00EFBC4E372" withBannerSlotId:@"58A0BB27A707FD48ECACF89B0E8A9657" withAppUserId:@""];
    self.calendarAd.delegate = self;
    [self.calendarAd showFromRootViewController:self];
    
    // Do any additional setup after loading the view.
} 

悬浮广告位

 @interface CalendarViewController ()<OSETSuspendAdDelegate>
@property (nonatomic,strong) OSETSuspendAd *suspendAd;
@end

@implementation CalendarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
       self.suspendAd = [[OSETSuspendAd alloc]initWithSlotId:@"5172584995BB18D05EAB3876E0B70015" withViewController:self];
        self.suspendAd.delegate = self;
        [self.suspendAd loadData];
    // Do any additional setup after loading the view.
} 

答题

 @interface AnswerAdViewController ()<OSETAnswerAdRewardVideoDelegate>
@property (nonatomic,strong) OSETAnswerAd *answerAdAd;
@end

@implementation AnswerAdViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
	//SlotId 激励视频广告位id  必传参数
	//InterstitialSlotId 插屏广告位id  
	//BannerSlotId banner广告位id 
	//AnswerNum 答题次数
    
    self.answerAdAd = [[OSETAnswerAd alloc]initWithSlotId:@"971D11E82E1009B5CAA2D00EFBC4E372"
                                   withInterstitialSlotId:@"4FD8476AE54A3DBA39CCD635BBD48957"
                                   withBannerSlotId:@"58A0BB27A707FD48ECACF89B0E8A9657"
                                            withAnswerNum:@"3"];
    
    self.answerAdAd.delegate = self;
    [self.answerAdAd showFromRootViewController:self];


    // Do any additional setup after loading the view.
}
/// 激励视频关闭
- (void)OSETConstellatoryRewardVideoDidClose:(id)rewardVideoAd checkString:(NSString *)checkString{
    NSLog(@"ConstellatoryViewController --- rewardVideoDidClose ");
}
-(void)showAd{
    [self.answerAdAd showFromRootViewController:self];
}

/// 激励视频加载成功
/// @param rewardVideoAd 激励视频实例
/// @param slotId 广告位ID
- (void)OSETAnswerAdRewardVideoDidReceiveSuccess:(id)rewardVideoAd slotId:(NSString *)slotId{
    NSLog(@"%s",__FUNCTION__);
}

/// 激励视频加载失败
- (void)OSETAnswerAdRewardVideoLoadToFailed:(id)rewardVideoAd error:(NSError *)error{
    NSLog(@"%s",__FUNCTION__);
}

/// 激励视频点击
- (void)OSETAnswerAdRewardVideoDidClick:(id)rewardVideoAd{
    NSLog(@"%s",__FUNCTION__);
}

/// 激励视频关闭
- (void)OSETAnswerAdRewardVideoDidClose:(id)rewardVideoAd checkString:(NSString *)checkString{
    NSLog(@"%s",__FUNCTION__);
}

//激励视频播放出错
- (void)OSETAnswerAdRewardVideoPlayError:(id)rewardVideoAd error:(NSError *)error{
    NSLog(@"%s",__FUNCTION__);
}

//激励视频播放结束
- (void)OSETAnswerAdRewardVideoPlayEnd:(id)rewardVideoAd  checkString:(NSString *)checkString{
    NSLog(@"%s",__FUNCTION__);
}
//激励视频开始播放
- (void)OSETAnswerAdRewardVideoPlayStart:(id)rewardVideoAd{
    NSLog(@"%s",__FUNCTION__);
}
//激励视频奖励
- (void)OSETAnswerAdRewardVideoOnReward:(id)rewardVideoAd checkString:(NSString *)checkString{
    NSLog(@"%s",__FUNCTION__);
} 

天气

 @interface CalendarViewController ()<OSETWeatherAdDelegate>
@property (nonatomic,strong) OSETWeatherAd *weatherAd;
@end

@implementation CalendarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
	//SlotId 激励视频广告位id  必传参数
	//InterstitialSlotId 插屏广告位id  
	//BannerSlotId banner广告位id 
  self.weatherAd = [[OSETWeatherAd alloc]initWithSlotId:@"激励视频广告位id"
                                    withInterstitialSlotId:@"插屏广告位id"
                                          withBannerSlotId:@"banner广告位id"];
     self.weatherAd.delegate = self;
     [self.weatherAd showFromRootViewController:self];



    // Do any additional setup after loading the view.
}
- (void)OSETWeatherRewardVideoDidReceiveSuccess:(id)rewardVideoAd slotId:(NSString *)slotId{
    NSLog(@"OSETWeatherRewardVideoDidReceiveSuccess");
}

/// 激励视频加载失败
- (void)OSETWeatherRewardVideoLoadToFailed:(id)rewardVideoAd error:(NSError *)error{
    NSLog(@"OSETWeatherRewardVideoLoadToFailed== %@",error);
}

/// 激励视频点击
- (void)OSETWeatherRewardVideoDidClick:(id)rewardVideoAd{
    NSLog(@"OSETWeatherRewardVideoDidClick");
}

/// 激励视频关闭
- (void)OSETWeatherRewardVideoDidClose:(id)rewardVideoAd checkString:(NSString *)checkString{
    NSLog(@"OSETWeatherRewardVideoDidClose");
}

//激励视频播放出错
- (void)OSETWeatherRewardVideoPlayError:(id)rewardVideoAd error:(NSError *)error{
    NSLog(@"OSETWeatherRewardVideoPlayError == %@",error);
}

//激励视频播放结束
- (void)OSETWeatherRewardVideoPlayEnd:(id)rewardVideoAd  checkString:(NSString *)checkString{
    NSLog(@"OSETWeatherRewardVideoPlayEnd");
}
//激励视频开始播放
- (void)OSETWeatherRewardVideoPlayStart:(id)rewardVideoAd{
    NSLog(@"OSETWeatherRewardVideoPlayStart");
}
//激励视频奖励
- (void)OSETWeatherRewardVideoOnReward:(id)rewardVideoAd checkString:(NSString *)checkString{
    NSLog(@"OSETWeatherRewardVideoOnReward");
} 

代理方法说明

所有广告位至少有四个代理方法,广告加载成功、广告加载失败、广告点击、广告关闭,
视频类广告需要在加载成功后手动调起广告,详细使用参考demo

隐私政策

SDK用到的隐私信息 包括精确位置(位置)、设备 ID(标识符)、广告数据(使用数据)、其他数据 类型.
用于第三方广告,与用户身份关联,用于追踪目的。(App Store  5.1.2&&3.3.9 被拒)

SDK 错误码

code描述
A3001网络错误
A4001初始化错误, 包括广告位为空、AppKey为空、ViewController为空
A4003广告位错误
A4006广告未曝光
A4007设备不支持
A4008设备方向不支持
A4009开屏跳过按钮定义非法
A4010开屏bottomView设置非法
A4011请求广告超时
A4013系统不支持,原生视频模板广告只支持 iOS 9 及以上系统
A4014广告数据返回前尝试展示广告, 例如激励视频拉到广告后才可以调用展示接口
A4015广告已经曝光过,不允许二次展示,请重新拉取
A4016应用横竖方向与广告位支持方向不匹配
A5001后台数据错误
A5002视频素材下载错误
A5003视频素材播放错误
A5004没匹配的广告,禁止重试,否则影响流量变现效果
A5005广告请求量或者消耗等超过日限额,请第二天再请求广告
A5006包名校验非法
A5009广告请求量或者消耗等超过小时限额,请一小时后再请求广告
A5010广告样式校验失败,请检查广告位与接口使用是否一致
A5012广告过期,请重新拉取
A5013广告拉取过于频繁,请稍后再试
A5014视频广告视频和图片素材都下载错误
A5015当前版本不出广告
A5016JSON数据解析失败
A6000未知错误,联系腾讯广告商务同事协助排查
B20000成功
B20001没有合适的广告返回而导致的请求没有填充,偶尔出现属于正常情况。如果出现情况较多或者必现的话,请先检查一下广告尺寸是否填写正确,是否有使用模拟器测试广告,单个设备是否一天请求了大量广告但没有展示或者展示数极低等。排查以上问题依然没有结论可以联系技术支持同学或者提交工单(包含代码位和出现概率以及请求时间)相关同学查明后会做出回复。
B40000http content type错误
B40001http request pb错误
B40002source_type=‘app’, 请求app不能为空
B40003source_type=‘wap’, 请求wap不能为空
B40004广告位不能为空
B40005广告位尺寸不能为空
B40006广告位ID不合法,例如,位数不对或者输入的广告位ID错误。
B40007广告数量错误
B40008图片尺寸错误
B40009媒体ID不合法
B40010媒体类型不合法
B40011广告类型不合法
B40012媒体接入类型不合法,已废弃
B40013代码位ID是开屏代码位,但是adType不是开屏
B40014redirect参数不正确
B40015媒体请求里的字段上传的不正确或不完整,需要整改,请关注站内信的整改通知。
B40016代码位ID 与应用ID 不匹配或者应用ID 缺失。初始化时需要填写appid,且在activity中需要填写代码位ID。媒体要确保这两个ID填写正确且匹配。
B40017媒体接入类型不合法 API/SDK
B40018媒体在平台上录入的包名与项目里的包名不一致。
B40019媒体在平台上申请的代码位广告类型和代码中使用的广告类型接口不一致。例如平台上是开屏的广告类型,但是代码中请求的接口是banner或者其他非开屏的广告类型,如果不太清楚不同代码位类型对应的接口,麻烦去查询SDK包里的对接文档。
B40020开发注册新上线广告位超出日请求量限制
B40021apk签名SHA1值与媒体平台录入的SHA1不一致
B40022媒体在平台上申请的代码位“是否原生”属性与代码中使用的接口不匹配。例如:1. 媒体在平台上选择的是个性化模板banner广告的话,Android代码中请参考BannerExpressActivity进行调用;iOS代码中请参考BUDExpressBannerViewController进行调用。2. 媒体在平台上选择的是个性化模板插屏广告的话,代码中请参考InteractionExpressActivity进行调用;iOS代码位中请参考BUDExpressInterstitialViewController进行调用。PS:模板广告会带有express字样标识。
B40023os字段填的不对
B40024sdk 版本过低不返回广告
B40025渲染异常,分为两种情况:1、Android版本,媒体使用了非该应用所属账号下的SDK版本导致,请媒体到该代码位所属账号下工具-文档下载展示的SDK版本去进行接入。2、iOS版本,媒体使用2100之前的版本可能渲染异常,请媒体更新到最新版本接入即可解决该问题。
B40026使用海外ip请求国内服务器导致,请确认使用的是国内ip请求广告。
B40028ios老设备(涉及设备 iPad 4G/iPad 3G/iPhone 5/iPhone 5C/iPad Mini 1G/iPad 2G/iPhone 4S)被屏蔽,会不返回广告。在2310版本后放开了限制,媒体可以更新到2310或者之后的版本。
B40029两种情况:1. SDK版本低;如果您使用了原生类型为模板渲染的广告,即个性化模板广告,Android版本不能低于2017,iOS版本不能低于2011。2. 接口使用错误;如果您的SDK版本(双端)大于等于2500,代码位的原生类型是模板渲染,麻烦确认使用的接口为个性化模板广告。
B50001服务器错误
B60001show event处理错误
B60002click event处理错误
B60007激励视频验证服务器异常或处理失败
B-1数据解析失败。客户端代码问题的合集,可先排查以下情况:1:媒体在子线程调用了show。2:注册点击事件 时viewgroup传空。3:媒体在onFeedLoaded回调里的业务逻辑发生了异常,导致SDK走到了onError回调 中。排查以上问题依然没有结论可以联系技术支持同学或者提交工单(包含代码位和出现概率以及请求时 间)。
B-2网络错误
B-3解析数据没有ad
B-4返回数据缺少必要字段
B-5bannerAd加载图片失败
B-6插屏广告图片加载失败
B-7开屏广告图片加载失败
B-8频繁请求
B-9请求实体为空
B-10缓存解析失败
B-11缓存过期
B-12缓存中没有开屏广告
B101渲染结果数据解析失败
B102未匹配到主模板:主模板没有下载到本地导致。偶发在首次请求广告时属于正常情况。
B103未匹配到子模板:偶发在接入初期,没有匹配到模板导致。待sdk将模板下载成功后不会出现。
B104物料数据异常
B105模版数据解析异常
B106渲染异常
B107模板渲染超时未回调,可能原因有1. 网络原因或者2. 硬件原因,因此导致渲染失败,可以更换手机或者网络环境测试。
C0SDK没有进行初始化
C1SDK初始化失败
C2无效的参数传入
C3播放视频时发生错误
C4SDK初始化不完整,发生异常
C5广告被插件拦截, 发生错误
C6SDK无法读取或写入文件
C7未知的设备标识符
C8尝试播放广告时发生异常
C9SDK内部发生异常
C10如果这个代码被调用,意味暂时还没有广告可播放,SDK会定时向服务器进行查询,在获取到广告后,此错误代码会取消
D-1没有广告填充,可能导致的原因:1.您在测试期间所获取的广告均为Mintegral的正式广告,因此会受到算法智能优化的影响,若一段时间内大量加载和展示广告,可能导致一段时间后没有广告填充的现象。
D-9请求超时
D-10appID和appKey不匹配,解决方案:检查APPkey和APPID是否填写正确,APPkey可以在应用设置(APP Setting)模块顶部获取
D-1201该unitID不存在/填写错误
D-1202unitID没传
D-1203在该appID和unitID不匹配
D-1205传入的unitID广告类型不符
D-130appID没有传入
D-1302该appID不存在/填写错误
D-1904请求时的网络状态不对,一般是SDK初始化还未完成就去请求导致的
D-2102无法取得osVersion,一般是GDPR开关导致的
E500420请求的app已经关闭广告服务
E500422请求参数缺少设备信息
E500424缺少设备id相关信息
E500428缺少广告为信息
E500430错误的广告位信息
E500432广告位不存在,或者appid与广告位不匹配
E500433广告位不存在或是已关闭
E500435设备的操作系统类型,与请求的app的系统类型不匹配
E500436广告单元id与请求的广告类型不匹配
E500437缺少idfa。仅(iOS)
E500473请求的app不存在
E500700app未设置聚合策略
E500701app未开通任何广告渠道
E200000无广告填充
E600100网络出错
E600101请求出错
E600102未找到该渠道的适配器
E600103配置的策略为空
E600104文件下载错误
E600105下载广告超时
E600106聚合通知给开发者的统一错误码,由于多渠道无法区分具体原因。配置单一渠道时使用该渠道错误码。
E600107不能在后台调用load
E600108protoBuf协议解析出错
E610002激励视频播放出错
E600103激励视频广告未准备好
E600104server下发的广告信息缺失关键信息
E600105下载的文件校验md5出错
E620002开屏广告不支持当前方向
E620003开屏广告不支持的资源类型
S70001网络请求失败
S70002未能匹配到合适的广告
S3000权限验证失败
S99901未捕获的异常
S5001DSP没有出价
S5002广告位不投放
S5003DSP log url 没有配置
S5004广告位被禁用
S5005SDK被禁用
S6001请求数超过限流次数或者超时
Last Updated:
Contributors: zhaochangchang, zhaochangchang@shenshiads.com, zhaochangchang