概要
本文档描述了iOS开发者如何集成Mintegral SDK产品,通过集成Mintegral SDK 展示广告创造收益 Mintegral SDK提供了8种广告形式,包括:Banner(横幅广告)、Native(原生广告)、NativeVideo(原生视频)、Auto Rending Native(自动渲染原生广告)、RewardVideo(激励性视频)、Interstitial(插屏)、Interstitial Video(插屏视频)、InterActive(试玩广告)、Splash(开屏广告)。
开发环境
开发工具: MTGSDK 从6.3.3版本开始不再支持XCode11以下版本archive; </br>
6.9.0版本需要使用Xcode12.5及以上版本; 6.9.1版本开始解除了对Xcode12.5的依赖
获取SDK
我们提供两种方式去集成Mintegral iOS-SDK:使用 和 。
关于SDK的文件大小: </br> SDK基础公共包,增加2.2M 左右</br> 集成全部广告样式,最大增加0.3M 左右,共2.5M</br>
获取SDK版本号
搜索MTGSDK.h文件,找到MTGSDKVersion
iOS 14 指引
MTGSDK 6.6.0 版本提供了对 iOS SKAdNetwork 的支持。
为您的应用适配iOS14,请按照以下步骤集成:
1、升级 MTGSDK 至 6.6.0 或以上版本。
2、将 MTGSDK 的 SKAdNetwork ID 添加到 info.plist 中。
SKAdNetwork IDs
添加SKAdNetwork ID到Info.plist
请MTGSDK的SKAdnetwork ID清单添加到您的文件中。
在Xcode,您的工程中,打开 Info.plist 文件。
在Info.plist文件中,点击在一个key旁的加号 (+ ) 来创建一个新的属性的key。
录入 SKAdNetworkItems 并选择 Array 。
添加dictionary,并在dictionary中添加一个String。
每一个String项,请添加 SKAdNetworkIdentifier 为 key, ad network identifier 为其数值。
MTG SKAdnetwork ID列表中包含了Mintegral和DSP合作方ID。列表有两种形式:JSON 和 XML 。请将全部ID添加至您的 Info.plist中。请注意,该SKAdNetwork ID列表是定期更新的:
App Tracking Transparency
要获取 ATT 权限,请更新您的 Info.plist,添加 NSUserTrackingUsageDescription 字段和自定义文案描述。
Sample:
Copy <key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalized ads to you.</string>
向用户申请权限时,请调用 requestTrackingAuthorizationWithCompletionHandler: 建议您申请权限后再请求广告,以便MTG能准确获得用户的授权。
Copy #import <AppTrackingTransparency/AppTrackingTransparency.h>
#import <AdSupport/AdSupport.h>
- (void)requestIDFA {
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
// 跟踪授权已完成,在这里开始加载广告。
// [self loadAd];
}];
}
Apple App隐私信息说明
为了帮助您回答有关MTGSDK收集信息的调查表,请参阅下表。这里是我们收集的所有信息,没有提及的信息则没有收集。
Copy 注:
此表仅介绍MTGSDK数据收集,未介绍APP或其他SDK的数据收集和使用。
Diagnostics-Performance Data
Diagnostics-Performance Data
Diagnostics-Performance Data
Usage Date - Advertising Data
SDK的初始化
作为集成的第一步,你需要先将Mintegral的SDK进行初始化。
手动集成需做的初始化前的参数配置
1、手动集成需导入基本的静态库
CoreGraphics.framework
Foundation.framework
UIKit.framework
libsqlite3.tbd (在Xccode7以下是libsqlite3.dylib)
libz.tbd (在Xcode7以下是libz.dylib)
AdSupport.framework
StoreKit.framework
QuartzCore.framework
CoreTelephony.framework
MobileCoreServices.framework
AVFoundation.framework
WebKit.framework
2、增加XCode的链接器参数
在工程的Build Settings中,找到Other Linker Flags,增加一个flag:-ObjC,注意大小写。
初始化
在AppDelegate里的如下方法中调用MTGSDK的初始化方法,传入在Mintergal后台得到的AppID和AppKey。初始化时,MTGSDK会从服务器拉取配置信息。建议在主线程调用此方法。
Copy //ApiKey 和 AppKey是一样的
- (void)setAppID:(nonnull NSString *)appID ApiKey:(nonnull NSString *)appKey;
示例代码:
Copy - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
[[MTGSDK sharedInstance] setAppID:@"your appID" ApiKey:@"your appKey"];
}
横幅广告接入
横幅广告是在应用布局中占据一处位置的矩形图片文字广告。用户与应用互动时,这类广告会停留在屏幕上,并且可在一段时间后自动刷新。
广告效果示意:
导入头文件
Copy #import <MTGSDK/MTGSDK.h>
#import <MTGSDKBanner/MTGBannerAdView.h>
#import <MTGSDKBanner/MTGBannerAdViewDelegate.h>
初始化MTGBannerAdView
Copy /**
初始化bannerview
@param adSize 期望返回banner素材大小值,例如CGSizeMake(320, 50)
@param placementId 版位id,您可以从后台创建。
@param unitId 广告单元id,您可以在后台PlacementId下创建。
@param rootViewController 显示广告的Controller
@return
*/
- (nonnull instancetype)initBannerAdViewWithAdSize:(CGSize)adSize
placementId:(nullable NSString *)placementId
unitId:(nonnull NSString *) unitId
rootViewController:(nullable UIViewController *)rootViewController;
/**
初始化bannerview
@param MTGBannerSizeType 参考下方BannerSizeType
@param placementId 版位id,您可以从后台创建。
@param unitId 广告位id,您可以在后台PlacementId下创建。
@param rootViewController 显示广告的Controller
@return
*/
- (nonnull instancetype)initBannerAdViewWithBannerSizeType:(MTGBannerSizeType)bannerSizeType
placementId:(nullable NSString *)placementId
unitId:(nonnull NSString *) unitId
rootViewController:(nullable UIViewController *)rootViewController;
bannerSizeType 介绍:
我们建议使用320*50,该尺寸的填充率会更能得到保障,调整尺寸可能一定程度影响收入。
Copy typedef NS_ENUM(NSInteger,MTGBannerSizeType) {
/*表示固定横幅广告尺寸-320pt x 50pt */
MTGStandardBannerType320x50,
/*表示固定横幅广告尺寸 - 320pt by 90pt.*/
MTGLargeBannerType320x90,
/*表示固定横幅广告尺寸 - 300pt by 250pt.*/
MTGMediumRectangularBanner300x250,
/*如果设备高度 <=720,表示固定横幅广告尺寸 - 320pt by 50pt;
如果设备高度 > 720,表示固定横幅广告尺寸 - 728pt by 90pt*/
MTGSmartBannerType
};
请求广告
Copy - (void)loadBannerAd;
销毁BannerAdView
Copy /**
此方法将清除MTGBannerAdView的所有变量和属性。
注意:调用此方法后,如果需要继续使用MTGBannerAdView,则必须重新初始化MTGBannerAdView
*/
- (void)destroyBannerAdView;
其他功能API介绍
Copy /**
自动刷新时间(以秒为单位)设置在10s〜180s的范围内。
如果设置为0,将不会自动刷新。
需要在load广告之前调用
*/
@property(nonatomic,assign) NSInteger autoRefreshTime;
/**
是否显示关闭按钮
No表示关闭,Yes表示启用,默认为 MTGBool Unknown
*/
@property(nonatomic,assign) MTGBool showCloseButton;
/**
* 在adViewLoadSuccess回调之后调用,获取此次请求广告的requestId
*/
@property(nonatomic,copy,readonly) NSString * _Nullable requestId;
示例代码
Copy #import "TestViewController.h"
#import <MTGSDK/MTGSDK.h>
#import <MTGSDKBanner/MTGBannerAdView.h>
#import <MTGSDKBanner/MTGBannerAdViewDelegate.h>
@interface TestViewController ()<MTGBannerAdViewDelegate>
@property (nonatomic, strong) MTGBannerAdView *bannerAdView;
@end
@implementation TestViewController
- (void)viewDidLoad {
[super viewDidLoad];
if (_bannerAdView == nil) {
_bannerAdView = [[MTGBannerAdView alloc]initBannerAdViewWithAdSize:size placementId:kBannerPlacementId unitId:kBannerUnitID rootViewController:self];
_bannerAdView.frame = CGRectMake(10, 100, size.width,size.height);
_bannerAdView.delegate = self;
_bannerAdView.autoRefreshTime = 0;
_bannerAdView.delegate = self;
[self.view addSubview:_bannerAdView];
[_bannerAdView loadBannerAd];
}
}
- (IBAction)destroyButtonAction:(id)sender
{
[_bannerAdView destroyBannerAdView];
}
#pragma mark MTGBannerAdViewDelegate
- (void)adViewLoadSuccess:(MTGBannerAdView *)adView
{
//成功加载adView广告位
[self log:@"adViewLoadSuccess"];
}
- (void)adViewLoadFailedWithError:(NSError *)error adView:(MTGBannerAdView *)adView
{
//广告加载失败
[self log:[NSString stringWithFormat:@"Failed to load ads, error:%@", error.localizedDescription]];
}
- (void)adViewWillLogImpression:(MTGBannerAdView *)adView
{
//广告将要展示
[self log:@"adViewWillLogImpression"];
}
- (void)adViewDidClicked:(MTGBannerAdView *)adView
{
//广告被点击
[self log:@"adViewDidClicked"];
}
- (void)adViewWillLeaveApplication:(MTGBannerAdView *)adView
{
//当用户由于点击要离开您的应用程序时触发该回调,您的应用程序将移至后台
[self log:@"adViewWillLeaveApplication"];
}
- (void)adViewWillOpenFullScreen:(MTGBannerAdView *)adView
{
//将打开全屏视图。在打开storekit或在应用程序中打开网页时触发
[self log:@"adViewWillOpenFullScreen"];
}
- (void)adViewCloseFullScreen:(MTGBannerAdView *)adView
{
//将关闭全屏视图。关闭storekit或关闭应用程序中的网页时发送
[self log:@"adViewCloseFullScreen"];
}
@end
原生(视频)广告接入
原生广告是时下非常流行的广告类型之一,广告SDK会将素材信息返回给您的app,您可以根据需要对元素进行组装和渲染,进而使得广告内容更贴近您的产品风格,用户体验更好。
注:该广告类型仅对部分开发者提供,如有需要请联系您的AM 或 致信developer@mintegral.com
广告效果示意:
导入头文件
Copy #import <MTGSDK/MTGSDK.h>
初始化MTGNativeAdManager
Copy /*
初始化MTGNativeAdManager
@param unitId广告单元的ID。您可以从我们的后台创建您的广告单元ID。
@param fbPlacementId Facebook PlacementID用于向Facebook请求广告。目前已废弃,可传nil
@param videoSupport DEPRECATED_ATTRIBUTE 后台可配置:https://www.mintegral.net
@param numAdsRequested 您希望拉取到的最大的广告数。最大数字为10。如果传递的数字大于10,它将默认为10。
@param viewController 将用于呈现SKStoreProductViewController的UIViewController
(iTunes Store产品信息)或应用程序内浏览器。如果未设置,它将是当前UIWindow的根viewController。但是,如果您的rootViewController正在显示其他视图控制器,则可能无法显示我们的视图控制器。因此设置此属性是必要的。
*/
- (nonnull instancetype)initWithPlacementId:(nullable NSString *)placementId
unitID:(nonnull NSString *)unitId
fbPlacementId:(nullable NSString *)fbPlacementId
videoSupport:(BOOL)videoSupport
forNumAdsRequested:(NSUInteger)numAdsRequested
presentingViewController:(nullable UIViewController *)viewController;
示例代码:
Copy [[MTGNativeAdManager alloc] initWithPlacementId:KNativeUnitID unitID:KNativeUnitID fbPlacementId:KPlacementID videoSupport:YES forNumAdsRequested:1 presentingViewController:self];
预加载广告(强烈建议)
我们对Native(NativeVideo)广告形式提供预加载功能(可选),可以在初始化环节调用以下代码进行预加载,提高你的广告加载效率。示例代码如下:
Copy /**
*
@method
@abstract 预加载原生广告
@param placementId 广告版位ID。 您可以从后台创建它。
@param unitId广告单元的ID。 您可以从后台PlacementID下创建。
@param fbPlacementId Facebook PlacementID用于请求来自Facebook的广告,目前已废弃,可传nil
@param videoSupport 是否加载视频广告,如果希望展示视频广告,请将videoSupport设置为yes
@param numAdsRequested您要预加载的广告数量。 最大数字为10。如果传递的数字大于10,将默认为10
*/
- (void)preloadNativeAdsWithPlacementId:(nullable NSString *)placementId
unitId:(nonnull NSString *)unitId
fbPlacementId:(nullable NSString *)fbPlacementId
videoSupport:(BOOL)videoSupport
forNumAdsRequested:(NSUInteger)numAdsRequested;
请求广告
Mintegral SDK调用此方法时会优先从缓存里读取广告,如果缓存里有广告,则直接返回,进而提升展示效率;如果缓存里没有,则会向服务器发送广告请求获取广告。 请求方法如下:
渲染广告
您可以根据nativeAdsLoaded的回调去渲染广告,同时我们提供MTGMediaView去展示图片(视频)广告,调用以下方法去展示广告。MTGMediaView的最佳设置展示比例大小为16:9。
Copy - (void)setMediaSourceWithCampaign:(MTGCampaign *)campaign unitId:(NSString*)unitId;
获取Request ID
若广告展示过程中发现问题,可以通过该方法将 Request ID 记录并反馈到MTG.需要在 load success 之后调用
Copy /**
* 在nativeAdsLoaded回调之后调用,获取此次请求广告的requestId
*/
@property (nonatomic, readonly) NSString *_Nullable requestId;
Adchoice标记
我们提供MTGAdChoicesView来渲染广告标记(Adchoice)。对其两个属性进行赋值即可完成广告标记。
Tip:我们强烈建议开发者规划合适位置展示此图标,若未展示,会影响您后续的广告收益。
Copy /**
初始化View
@param 为了获得最佳的用户体验,请将该视图的大小与AdChoiceIcon的大小保持相同,可以从MTGCampaign的-adChoiceIconSize中提取该视图的大小。如果该Size值为0,可以不展示Adchoice
*/
- (instancetype)initWithFrame:(CGRect)frame;
/**
campaign对象将提供 AdChoices信息,如image url 和 click url
*/
@property (nonatomic, weak, readwrite, nullable) MTGCampaign *campaign;
对view设置广告点击跳转事件
Copy - (void)registerViewForInteraction:(UIView *)view withViewController:(UIViewController *)viewController withClickableViews:(NSArray *)clickableViews;
- (void)registerViewForInteraction:(UIView *)view withViewController:(UIViewController *)controller;
Copy #import <UIKit/UIKit.h>
#import "MTGCampaign.h"
NS_ASSUME_NONNULL_BEGIN
@protocol MTGMediaViewDelegate;
@class MTGNativeAdManager;
@interface MTGMediaView : UIView
/* 为了获得最佳的用户体验,请将mediaView的宽高比保持为16:9 */
- (instancetype)initWithFrame:(CGRect)frame;
/**
可以再次设置Media Source以重复使用此视图。
*/
- (void)setMediaSourceWithCampaign:(MTGCampaign *)campaign unitId:(NSString*)unitId;
@property (nonatomic, weak, nullable) id<MTGMediaViewDelegate> delegate;
// 是否同意广告点击后为全屏模式,默认为YES
@property (nonatomic, assign) BOOL allowFullscreen;
// 是否允许在视频ready后从静态图像变更为播放视频,默认为YES
@property (nonatomic, assign) BOOL videoRefresh;
// 是否允许自动播放视频,默认为YES
@property (nonatomic, assign) BOOL autoLoopPlay;
/* 是否展示进度条,默认为YES */
@property (nonatomic, assign) BOOL showVideoProcessView;
/* 是否显示声音指示器视图,默认为YES */
@property (nonatomic, assign) BOOL showSoundIndicatorView;
/* 是否静音, 默认为YES,表示视频播放器已静音*/
@property (nonatomic, assign) BOOL mute;
@property (nonatomic, strong, readonly) MTGCampaign *campaign;
@property (nonatomic, readonly) NSString *unitId;
/**
在调用'setMediaSourceWithCampaign:(MTGCampaign *)campaign unitId:(NSString*)unitId'之后,
您可以根据需要通过isVideoContent检查此MediaView是否有视频内容
*/
@property (nonatomic,readonly,getter = isVideoContent) BOOL videoContent;
@end
@protocol MTGMediaViewDelegate <NSObject>
@optional
/**
@method
@abstract
在MTGMediaView进入全屏视图之前发送
@param mediaView:针对MTGMediaView的回调
*/
- (void)MTGMediaViewWillEnterFullscreen:(MTGMediaView *)mediaView;
/**
@method
@abstract
在MTGMediaView退出全屏视图时发送
@param mediaView: 针对MTGMediaView的回调
*/
- (void)MTGMediaViewDidExitFullscreen:(MTGMediaView *)mediaView;
/**
* 当视频广告开始播放时发送
*
* @param mediaView: 针对MTGMediaView的回调
*/
- (void)MTGMediaViewVideoDidStart:(MTGMediaView *)mediaView;
/**
* 当视频播放完成后发送
*
* @param mediaView: 针对MTGMediaView的回调
*/
- (void)MTGMediaViewVideoPlayCompleted:(MTGMediaView *)mediaView;
/**
@method
@abstract
当用户点击广告时发送
*/
- (void)nativeAdDidClick:(nonnull MTGCampaign *)nativeAd;
- (void)nativeAdDidClick:(nonnull MTGCampaign *)nativeAd mediaView:(MTGMediaView *)mediaView;
/**
@method
@abstract
广告开始跳转时发送
@param clickUrl 广告的clickurl
*/
- (void)nativeAdClickUrlWillStartToJump:(nonnull NSURL *)clickUrl;
- (void)nativeAdClickUrlWillStartToJump:(nonnull NSURL *)clickUrl mediaView:(MTGMediaView *)mediaView;
/**
@method
@abstract
当广告跳转到新的url之后发送
@param jumpUrl 跳跃时的URL
@discussion 如果广告的最终跳转网址已被缓存,则不会调用该方法
*/
- (void)nativeAdClickUrlDidJumpToUrl:(nonnull NSURL *)jumpUrl;
- (void)nativeAdClickUrlDidJumpToUrl:(nonnull NSURL *)jumpUrl mediaView:(MTGMediaView *)mediaView;
/**
@method
@abstract
在广告网址到达最终跳转网址后发送
@param finalUrl为最终跳转URL
@param error跳转过程中产生的错误
*/
- (void)nativeAdClickUrlDidEndJump:(nullable NSURL *)finalUrl
error:(nullable NSError *)error;
- (void)nativeAdClickUrlDidEndJump:(nullable NSURL *)finalUrl
error:(nullable NSError *)error mediaView:(MTGMediaView *)mediaView;
- (void)nativeAdImpressionWithType:(MTGAdSourceType)type mediaView:(MTGMediaView *)mediaView;
@end
示例代码
Copy #import "TestViewController.h"
#import <MTGSDK/MTGSDK.h>
#import <MTGSDK/MTGNativeAdManager.h>
@interface TestViewController ()<MTGNativeAdManagerDelegate,MTGMediaViewDelegate>
@property (nonatomic, strong) MTGNativeAdManager *nativeVideoAdManager;
@property (weak, nonatomic) IBOutlet MTGMediaView *mMediaView;
@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;
@property (weak, nonatomic) IBOutlet UILabel *appNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *appDescLabel;
@property (weak, nonatomic) IBOutlet UIButton *adCallButton;
@property (weak, nonatomic) IBOutlet MTGAdChoicesView *adChoicesView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *adChoicesViewWithConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *adChoicesViewHeightConstraint;
@end
@implementation TestViewController
//Init MTGNativeAdManager
- (IBAction)initAdManagerButtonAction:(id)sender
{
//clean old demo view
[self cleanAllDemoView];
if (self.currentStyleIndex == 0) {
_nativeAdManager1 = [[MTGNativeAdManager alloc] initWithPlacementId:KNativePlacementId unitID:KNativeUnitID fbPlacementId:KPlacementID supportedTemplates:@[[MTGTemplate templateWithType:MTGAD_TEMPLATE_BIG_IMAGE adsNum:1]] autoCacheImage:NO adCategory:0 presentingViewController:self];
_nativeAdManager1.showLoadingView = YES;
_nativeAdManager1.delegate = self;
}
else if (self.currentStyleIndex == 1){
_nativeAdManager2 = [[MTGNativeAdManager alloc] initWithPlacementId:PlacementId unitID:KNativeUnitID fbPlacementId:KPlacementID videoSupport:NO forNumAdsRequested:1 presentingViewController:self];
_nativeAdManager3.delegate = self;
}
[self log:@"MTGNativeAdManager init"];
}
#pragma mark AdManger delegate
- (void)nativeAdsLoaded:(NSArray *)nativeAds nativeManager:(nonnull MTGNativeAdManager *)nativeManager
{
if (nativeAds.count > 0) {
MTGCampaign *campaign=nativeAds[0];
self.mMediaView.delegate = self;
//Set the camgaign for the MTGmediaview
[self.mMediaView setMediaSourceWithCampaign:campaign unitId:@"your unitid"];
self.appNameLabel.text = campaign.appName;
self.appDescLabel.text = campaign.appDesc;
[self.adCallButton setTitle:campaign.adCall forState:UIControlStateNormal];
[campaign loadIconUrlAsyncWithBlock:^(UIImage *image) {
if (image) {
[self.iconImageView setImage:image];
}
}];
// MTGAdchoiceview 配置
if (CGSizeEqualToSize(campaign.adChoiceIconSize, CGSizeZero)) {
//当campaign.adChoiceIconSize 为0时,建议将该adChoicesView隐藏
self.adChoicesView.hidden = YES;
}
else {
self.adChoicesView.hidden = NO;
// 建议根据广告参数设置adChoicesView的大小
self.adChoicesViewWithConstraint.constant = campaign.adChoiceIconSize.width;
self.adChoicesViewHeightConstraint.constant = campaign.adChoiceIconSize.height;
}
self.adChoicesView.campaign = campaign;
[ self.nativeVideoAdManager registerViewForInteraction:self.appDescLabel.text withCampaign:campaign];
}
}
- (void)nativeAdsFailedToLoadWithError:(NSError *)error nativeManager:(nonnull MTGNativeAdManager *)nativeManager
{
[self log:[NSString stringWithFormat:@"Failed to load ads, error:%@", error.localizedDescription]];
}
- (void)nativeAdImpressionWithType:(MTGAdSourceType)type nativeManager:(MTGNativeAdManager *)nativeManager
{
}
#pragma mark MediaView delegate
- (void)MTGMediaViewWillEnterFullscreen:(MTGMediaView *)mediaView{
[self log:@"MTGMedia View Will Enter Full Screen"];
}
- (void)MTGMediaViewDidExitFullscreen:(MTGMediaView *)mediaView{
[self log:@"MTGMedia View Did Exit Full Screen"];
}
#pragma mark MediaView and AdManger Click delegate
- (void)nativeAdDidClick:(MTGCampaign *)nativeAd
{
[self log:@"Registerview or mediaVie Ad is clicked"];
}
- (void)nativeAdDidClick:(MTGCampaign *)nativeAd nativeManager:(nonnull MTGNativeAdManager *)nativeManager
{
[self log:@"Registerview Ad is clicked"];
}
- (void)nativeAdDidClick:(MTGCampaign *)nativeAd mediaView:(nonnull MTGMediaView *)mediaView
{
[self log:@"MTGMediaView Ad is clicked"];
}
- (void)MTGMediaViewVideoPlayCompleted:(MTGMediaView *)mediaView {
[self log:NSStringFromSelector(_cmd)];
}
@end
自动渲染原生广告
自动渲染原生广告集成比普通原生广告更加简单,开发者只需提供宽高区域,MTG会自动展示与之契合的广告模板和素材。减少开发者对接成本的同时,更高效地利用MTG算法输出广告创意,进而提升开发者收入水平。
广告效果示意:
导入头文件
Copy #import "MTGNativeAdvancedAd.h"
MTGNativeAdvancedAd 初始化
Copy /**
初始化NativeAdvancedAd
@param adSize nativeAdvanced广告尺寸。我们建议您将尺寸设置为320 * 250。
@param placementId 广告版位ID。 您可以从后台创建。
@param unitId广告单元的ID。 您可以从后台PlacementID下创建它。
@param rootViewController用于显示全屏广告的视图控制器。
@end
*/
- (nonnull instancetype)initWithPlacementID:(nullable NSString *)placementID
unitID:(nonnull NSString *)unitID
adSize:(CGSize)adSize
rootViewController:(nullable UIViewController *)rootViewController NS_DESIGNATED_INITIALIZER;
可设置项 设置Style 可设置的target有title、subTitle、button、icon、container、mediaContent. 如图:
Copy /**
修改广告内容元素的方法
@param style 设置广告内容元素
@param target 可以设置标题,子标题,按钮,图标,container,mediaContent
@param values 可以设置view的背景颜色,字体大小,字体,颜色和元素间的距离
例如:
NSDictionary *styles = @{
@"list": @[
@{
// 目标元素
@"target": @"container",
// 样式值
@"values": @{
@"paddingTop": @(0),
@"paddingRight": @(0),
@"paddingBottom": @(0),
@"paddingLeft": @(0),
@"backgroundColor": @"#FC2E02",
@"fontSize": @(20),
@"color": @"#060602",
@"fontFamily": @"Apple Symbols"
}
}
]
};
*/
- (void)setAdElementsStyle:(NSDictionary *)style;
静音设置
Copy /**
是否使视频播放器静音。
如果要使视频播放器静音,则应设置为“Yes”,否则为“False”。
*/
@property(nonatomic,assign) BOOL mute;
自动化播放设置
Copy /** 用于控制广告视频播放的类型。 */
@property(nonatomic,assign) MTGNativeAdvancedAdVideoPlayType autoPlay;
关闭按钮设置
Copy /**
是否显示关闭按钮。
如果要显示关闭按钮,则应设置为“YES”,否则为“False”。
*/
@property(nonatomic,assign) BOOL showCloseButton;
获取Request ID
若广告展示过程中发现问题,可以通过该方法将 Request ID 记录并反馈到MTG.
需要在 load success 之后调用
Copy /**
* 在nativeAdvancedAdLoadSuccess回调之后调用,获取此次请求广告的requestId
*/
@property(nonatomic,copy,readonly) NSString *_Nullable requestId;
加载及展示广告
加载广告
Copy /**
请求广告
*/
- (void)loadAd;
判断是否加载完成
Copy /**
广告是否加载完成
@return YES表示有一个可用的广告,否则为NO
*/
- (BOOL)isAdReady;
展示广告
Copy /**
展示adView
@note 需要将该View在loadSuccess之后附加上广告,如果在loadSuccess之前获取adView,将获得不带广告的UIView
*/
- (UIView *)fetchAdView;
销毁广告
Copy /**
销毁广告,然后adView将从您的展示视图中移除
@note 调用此方法后,如果需要继续使用MTGNativeAdvancedAd,则必须重新初始化MTGNativeAdvancedAd
*/
- (void)destroyNativeAd;
MTGNativeAdvancedAdDelegate 介绍
Copy @protocol MTGNativeAdvancedAdDelegate <NSObject>
/**
广告加载完成
*/
- (void)nativeAdvancedAdLoadSuccess:(MTGNativeAdvancedAd *)nativeAd;
/**
广告加载失败
*/
- (void)nativeAdvancedAdLoadFailed:(MTGNativeAdvancedAd *)nativeAd error:(NSError *)error;
/**
广告将要展示
*/
- (void)nativeAdvancedAdWillLogImpression:(MTGNativeAdvancedAd *)nativeAd;
/**
广告被点击
*/
- (void)nativeAdvancedAdDidClicked:(MTGNativeAdvancedAd *)nativeAd;
/**
当用户由于点击要离开您的应用程序时触发该回调,您的应用程序将移至后台。
*/
- (void)nativeAdvancedAd WillLeaveApplication:(MTGNativeAdvancedAd *)nativeAd;
/**
将打开全屏视图。在打开storekit或在应用程序中打开网页时触发。
*/
- (void)nativeAdvancedAdWillOpenFullScreen:(MTGNativeAdvancedAd *)nativeAd;
/**
将关闭全屏视图。关闭storekit或关闭应用程序中的网页时发送。
*/
- (void)nativeAdvancedAdCloseFullScreen:(MTGNativeAdvancedAd *)nativeAd;
/**
当广告关闭时发送。
*/
- (void)nativeAdvancedAdClosed:(MTGNativeAdvancedAd *)nativeAd;
@end
示例代码
Copy - (void)createNewNativeAd:(CGSize)size {
_adManager = [[MTGNativeAdvancedAd alloc] initWithPlacementID:kNewNativePlacementId unitID:kNewNativeUnitID adSize:CGSizeMake(320, 90) rootViewController:self];
_adManager.delegate = self;
_adManager.showCloseButton = YES;
_adManager.mute = NO;
_adManager.autoPlay = YES;
NSDictionary *styles = @{
@"list": @[
@{
// 目标元素
@"target": @"container",
// 样式值
@"values": @{
@"paddingTop": @(0),
@"paddingRight": @(0),
@"paddingBottom": @(0),
@"paddingLeft": @(0),
@"backgroundColor": @"#FC2E02",
@"fontSize": @(20),
@"color": @"#060602",
@"fontFamily": @"Apple Symbols"
}
}
]
};
[_adManager setAdElementsStyle:styles];
}
- (void)loadButtonAction:(UIButton *)sender {
[self log:@"start loading"];
[self.adManager loadAd];
}
- (void)showButtonAction:(UIButton *)sender {
if ([_adManager isAdReady]) {
[self addAdView];
}
}
激励视频接入
激励视频是Mintegral平台效果非常好的广告形式,用户可以通过观看一段广告视频而获取奖励,由于广告视频素材非常具有创意和吸引力,因此会引起很多用户的兴趣,进而点击广告产生转化收入。
广告效果示意:
导入头文件
集成激励视频广告,需要导入以下头文件:
Copy #import <MTGSDK/MTGSDK.h>
#import <MTGSDKReward/MTGRewardAdManager.h>
静音处理
必须在load之前调用
Copy /* 开始时是否播放视频静音,默认为NOT。 设置为True表示静音*/
@property (nonatomic, assign) BOOL playVideoMute;
计时设置
必须在load之前调用
Copy /**
* 如果要更改关闭广告二次确认弹窗文本,调用该方法
*
* @param title 弹窗标题
* @param content 弹窗内容
* @param ConfirmText 确认按钮文本
* @param cancelText 取消按钮文本
*/
- (void)setAlertWithTitle:(NSString *_Nullable)title
content:(NSString *_Nullable)content
confirmText:(NSString *_Nullable)confirmText
cancelText:(NSString *_Nullable)cancelText;
Reward Plus设置
必须在load之前调用
该API仅表示接受投放Reward plus的广告,下发奖励依然依赖SDK中 onVideoAdDismissed 回调的奖励数量货币信息参数(MTGRewardAdInfo)进行奖励发放。
Copy /*
此方法用于为RewardVideo打开RewardPlus,如果需要,请在loadVideo之前进行设置,默认为No。
*/
@property (nonatomic,assign) BOOL openRewardPlus;
示例:
[MTGRewardAdManager sharedInstance].openRewardPlus = YES;
获取Request ID
若广告展示过程中发现问题,可以通过该方法将 Request ID 记录并反馈到MTG.需要在 load success 之后调用
Copy /**
* 在onAdLoadSuccess 回调之后调用,获取此次请求广告的requestId
*/
- (NSString *_Nullable)getRequestIdWithUnitId:(nonnull NSString *)unitId;
请求广告
请求广告时,需传入对应的广告版位placementId和广告单元unitId。建议开发者在展示广告之前,提前进行广告请求,进而给素材等资源的下载提供时间,减少用户在展示广告时等待的时间,提高用户体验和广告时间。
Copy /**
* 加载广告
* @param placementId 广告版位ID。 您可以从后台创建。
* @param unitId 广告单元的ID。 您可以从后台PlacementID下创建它。
* @param delegate 引用实现MTGRewardAdLoadDelegate的对象,将接收指定unitId的load事件。
*/
- (void) loadVideoWithPlacementId:(nullable NSString *)placementId
unitId:(nonnull NSString *)unitId
delegate:(nullable id <MTGRewardAdLoadDelegate>)delegate;
展示广告
展示广告之前建议先判断广告是否已经下载成功,如果视频可以播放SDK会返回成功信息,然后再传入对应的PlacementId、UntiId和viewController展示视频广告;如果返回失败,就放弃这次视频展示机会。
注意:userId用于服务器端回调(userId只能是数字和字母),如果是客户端回调可以不传
Copy /**
* 将返回指定的unitId是否已缓存完成可展示的状态。
*
* @param placementId 广告版位ID。 您可以从后台创建。
* @param unitId 广告单元的ID。 您可以从后台PlacementID下创建它。
*
* @return - 如果缓存已完成达到可展示状态,则为YES,否则为NO。
*/
- (BOOL) isVideoReadyToPlayWithPlacementId:(nullable NSString *)placementId unitId:(nonnull NSString *)unitId;
/**
* 展示广告
*
* @param placementId 广告版位ID。 您可以从后台创建。
* @param unitId 广告单元的ID。 您可以从后台PlacementID下创建它。
* @param rewardId 已废弃,默认传1
* @param userId 用于服务端回调
* @param userExtra 自定义参数,用于服务端回调。
* @param delegate 引用实现 MTGRewardAdShowDelegate的对象,接收指定unitid的展示事件
* @param viewController 应将viewController设置为根视图控制器 UIViewController
*/
- (void)showVideoWithPlacementId:(nullable NSString *)placementId
unitId:(nonnull NSString *)unitId
userId:(nullable NSString *)userId
userExtra:(nullable NSString *)userExtra
delegate:(nullable id <MTGRewardAdShowDelegate>)delegate
viewController:(nonnull UIViewController*)viewController;
Delegate介绍
MTGRewardAdLoadDelegate
Copy /**
* Load事件的Delegate
*/
@protocol MTGRewardAdLoadDelegate <NSObject>
@optional
/**
* 广告加载成功但视频尚未完全缓存完成,需要等待缓存素材时调用
*
*/
- (void)onAdLoadSuccess:(nullable NSString *)placementId unitId:(nullable NSString *)unitId;
/**
* 广告加载完成且准备好展示时调用
*/
- (void)onVideoAdLoadSuccess:(nullable NSString *)placementId unitId:(nullable NSString *)unitId;
/**
* 广告加载失败时调用
* @param error - 加载失败原因
*/
- (void)onVideoAdLoadFailed:(nullable NSString *)placementId unitId:(nullable NSString *)unitId error:(nonnull NSError *)error;
@end
MTGRewardAdShowDelegate
Copy /**
* show事件的Delegate
*/
@protocol MTGRewardAdShowDelegate <NSObject>
@optional
/**
* 广告展示时调用
*/
- (void)onVideoAdShowSuccess:(nullable NSString *)placementId unitId:(nullable NSString *)unitId;
/**
* 广告展示失败
* @param error - 展示失败原因
*/
- (void)onVideoAdShowFailed:(nullable NSString *)placementId unitId:(nullable NSString *)unitId withError:(nonnull NSError *)error;
/**
* 视频播放完成
*/
- (void) onVideoPlayCompleted:(nullable NSString *)placementId unitId:(nullable NSString *)unitId;
/**
* 视频播放结束后,广告结果页Endcard展示成功
*/
- (void) onVideoEndCardShowSuccess:(nullable NSString *)placementId unitId:(nullable NSString *)unitId;
/**
* 广告被点击
*/
- (void)onVideoAdClicked:(nullable NSString *)placementId unitId:(nullable NSString *)unitId;
/**
* 在取消展示广告后并将控件返回到您的应用时调用
* @param converted - BOOL 视频是否播放完整
* @param rewardInfo - 返回包括用户奖励信息的rewardInfo对象
* rewardInfo.rewardName 为货币名称,(long)rewardInfo.rewardAmount 为货币数量。
*/
- (void)onVideoAdDismissed:(nullable NSString *)placementId unitId:(nullable NSString *)unitId withConverted:(BOOL)converted withRewardInfo:(nullable MTGRewardAdInfo *)rewardInfo;
/**
* 广告被关闭
*/
- (void)onVideoAdDidClosed:(nullable NSString *)placementId unitId:(nullable NSString *)unitId;
@end
示例代码
Copy #import "MTGRewardVideoViewController.h"
#import <MTGSDKReward/MTGRewardAdManager.h>
#import <MTGSDK/MTGSDK.h>
@interface MTGRewardVideoViewController ()
<MTGRewardAdLoadDelegate,MTGRewardAdShowDelegate>
- (void)viewDidLoad {
[[MTGRewardAdManager sharedInstance] loadVideoWithPlacementId:KRewardPlacementID unitId:KRewardUnitID delegate:self];
}
- (IBAction)showVideoButtonAction:(id)sender
{
//检测在广告展示之前,广告是否缓存成功
if ([[MTGRewardAdManager sharedInstance] isVideoReadyToPlayWithPlacementId:@"your placementId" unitId:@"your unitId"]) {
[[MTGRewardAdManager sharedInstance] showVideoWithPlacementId:@"your placementId" unitId:@"your unitId"] withRewardId:@"your rewardid"] userId:@"" delegate:self viewController:self];
}
}
设置服务端回调(可选)
您可以根据需要选择通过SDK或者服务端回调信息。若需要设置服务端回调,可以在后台添加callbackURL,Mintegral会在视频播放完成后调用callbackurl给予信息的回调。
1.创建广告位时设置回调方式
当Mintegral服务端获知用户完成任务后,通过Callback URL通知开发者服务端,为用户增加积分,对开发者来说,该方式实现起来稍微复杂,但安全性高。
2 声明callbackUrl,只需要修改域名部分
3 Mintegral Server获知获知到该user_id增加积分后,通过callback url通知开发者服务端。callback url附加的参数如下:
传输ID,Mintegral服务端生成,具有唯一性
加密标识 MD5(user_id_reward_amount_trans_id_security_key)
4 开发者服务端一旦收到postback后,需给MTG服务端返回200或403
Copy 200 means:User has been rewarded successfully.
403 means:abnormal
1.sign does not match
2.user_id does not exist
5 Mintegral Server发起Postback后,若超时(20秒)无响应,则在24小时内每隔5分钟重试一次。
插屏图片广告接入
插屏广告会在屏幕上展示一条大图广告,用户可以通过关闭按钮来关闭广告。
注:MIntegral推出了全新的InterstitalVideo广告类型,相比普通Interstital广告会有更好的视觉效果和体验。该广告类型仅对部分开发者提供,如有需要请联系您的AM 或 致信developer@mintegral.com
广告效果示意:
导入头文件
Copy #import <MTGSDK/MTGSDK.h>
#import <MTGSDKInterstitial/MTGInterstitialAdManager.h>
MTGInterstitialAdManager初始化
初始化时,需要传入对应的广告位的PlacementId和UnitID,可以通过adCategory参数控制广告类型,如果对广告类型没有特殊要求,填MTGOFFERWALL_AD_CATEGORY_ALL(或者数字0)即可。
Copy /**
* 初始化 interstitial
* @param placementId 广告版位ID。 您可以从后台创建。
* @param unitId 广告单元的ID。 您可以从后台PlacementID下创建它。
* @param adCategory 希望获取的广告类型。 如游戏,应用程序或全部,默认为全部
*/
- (nonnull instancetype)initWithPlacementId:(nullable NSString *)placementId
unitId:(nonnull NSString *)unitId
adCategory:(MTGInterstitialAdCategory)adCategory;
加载广告和展示广告
Copy /**
* 加载Interstitial广告
*
* @param delegate 引用实现 MTGInterstitialAdLoadDelegate的对象,将接收指定unitid的load事件
*/
- (void)loadWithDelegate:(nullable id <MTGInterstitialAdLoadDelegate>) delegate;
/**
* 展示Interstitial广告
*
* @param delegate 引用实现 MTGInterstitialAdShowDelegate的对象,将接收指定unitid的show事件
* @param viewController - 用于展示插屏广告控制器的UIViewController。 如果未设置,它将是当前UIWindow的根viewController。 但是,如果您的rootViewController正在显示其他view controller,则可能无法显示我们的插屏控制器。 因此设置此属性是必要的。
*/
- (void)showWithDelegate:(nullable id <MTGInterstitialAdShowDelegate>)delegate presentingViewController:(nullable UIViewController *)viewController;
获取Request ID
若广告展示过程中发现问题,可以通过该方法将 Request ID 记录并反馈到MTG.
需要在 load success 之后调用
Copy /**
* 在onInterstitialLoadSuccess回调之后调用,获取此次请求广告的requestId
*/
@property (nonatomic,copy,readonly) NSString * _Nullable requestId;
示例代码
Copy #import "MTGInsterstialViewController.h"
#import <MTGSDKInterstitial/MTGInterstitialAdManager.h>
@interface MTGInsterstialViewController ()<MTGInterstitialAdLoadDelegate,MTGInterstitialAdShowDelegate>
@property (nonatomic, strong) MTGInterstitialAdManager *interstitialAdManager;
@end
@implementation MTGInsterstialViewController
- (void)viewDidLoad {
}
- (IBAction)initAdManagerButtonAction:(id)sender
{
if (!_interstitialAdManager) {
_interstitialAdManager = [[MTGInterstitialAdManager alloc]initWithPlacementId:KInterstitialPlacementID unitId:KInterstitialUnitID adCategory:0];
[self log:@"MTGInterstitialAdManager init"];
}
}
- (IBAction)loadInsterstialButtonAction:(id)sender
{
if (!_interstitialAdManager) {
_interstitialAdManager = [[MTGInterstitialAdManager alloc]initWithPlacementId:KInterstitialPlacementID unitId:KInterstitialUnitID adCategory:0];
}
[_interstitialAdManager loadWithDelegate:self];
}
- (IBAction)showInsterstialButtonAction:(id)sender
{
if (!_interstitialAdManager) {
_interstitialAdManager = [[MTGInterstitialAdManager alloc]initWithPlacementId:KInterstitialPlacementID unitId:KInterstitialUnitID adCategory:0];
}
[_interstitialAdManager showWithDelegate:self presentingViewController:self];
}
#pragma mark - Interstitial Delegate Methods
- (void) onInterstitialLoadSuccess{
[self log:NSStringFromSelector(_cmd)];
}
- (void) onInterstitialLoadSuccess:adManager{
[self log:NSStringFromSelector(_cmd)];
}
- (void) onInterstitialLoadFail:(nonnull NSError *)error{
[self log:NSStringFromSelector(_cmd)];
}
- (void) onInterstitialLoadFail:(nonnull NSError *)error adManager:(MTGInterstitialAdManager * _Nonnull)adManager{
[self log:NSStringFromSelector(_cmd)];
}
- (void) onInterstitialShowSuccess{
[self log:NSStringFromSelector(_cmd)];
}
- (void) onInterstitialShowSuccess:adManager{
[self log:NSStringFromSelector(_cmd)];
}
- (void) onInterstitialShowFail:(nonnull NSError *)error{
[self log:NSStringFromSelector(_cmd)];
}
- (void) onInterstitialShowFail:(nonnull NSError *)error adManager:(MTGInterstitialAdManager * _Nonnull)adManager{
[self log:NSStringFromSelector(_cmd)];
}
- (void) onInterstitialClosed{
[self log:NSStringFromSelector(_cmd)];
}
- (void) onInterstitialClosed:adManager{
[self log:NSStringFromSelector(_cmd)];
}
- (void) onInterstitialAdClick{
[self log:NSStringFromSelector(_cmd)];
}
- (void) onInterstitialAdClick:adManager{
[self log:NSStringFromSelector(_cmd)];
}
@end
插屏视频广告接入
插屏视频广告是插屏广告的升级版本,展示广告时会给用户展示一个全屏或半屏的视频,通过更有吸引力的视频提高用户的兴趣。
广告效果示意:
1 导入头文件
Copy #import <MTGSDK/MTGSDK.h>
#import <MTGSDKInterstitialVideo/MTGInterstitialVideoAdManager.h>
2 MTGInterstitialVideoAdManager的初始化
请求视频广告,需传入对应的广告位的PlacementID 和 UnitID。
Copy /**
* 初始化InterstitialVideo
* @param placementId 广告版位ID。 您可以从后台创建。
* @param unitId 广告单元的ID。 您可以从后台PlacementID下创建它。
* @param delegate - 引用实现MTGInterstitialVideoDelegate的对象
*/
- (nonnull instancetype)initWithPlacementId:(nullable NSString *)placementId
unitId:(nonnull NSString *)unitId
delegate:(nullable id<MTGInterstitialVideoDelegate>)delegate;
3 请求广告和展示广告
Copy /**
* 加载interstitialVideo广告
*/
- (void)loadAd;
/** @name 展示插页式视频广告
*从指定的视图控制器显示interstitialVideo广告
* @param viewController应该用于展示interstitialVideo广告的视图控制器
*/
- (void)showFromViewController:(UIViewController *_Nonnull)viewController;*_Nonnull)viewController;
/**
* 判断广告是否加载完成达到可展示状态
@param placementId 广告版位ID。 您可以从后台创建。
@param unitId 广告单元的ID。 您可以从后台PlacementID下创建它。
*
* @return- 如果已加载完成可播放,则为YES,否则为NO。
*/
- (BOOL)isVideoReadyToPlayWithPlacementId:(nullable NSString *)placementId unitId:(nonnull NSString *)unitId;
静音处理
必须在load之前调用
Copy /*在开始时视频是否静音,默认为NOT。 设置为True表示静音* /
@property (nonatomic, assign) BOOL playVideoMute;
插屏视频奖励模式接口
必须在load之前调用
Copy /**
* InterstitialVideo 奖励模式设置
*
* @param ivRewardMode {@link MTGIVRewardMode}获取受支持类型的列表
* @param playRate设置奖励alertView的时间,范围为0〜1(例如:设置为0.6,表示60%)。
注:在MTGIVRewardPlayMode中,playRate值指当播放达到设置的playRate时将出现奖励alertView。
在MTGIVRewardCloseMode中,playRate指单击关闭按钮时,如果视频播放时间小于设置的playRate,则将显示奖励alertView。
NOTE: 必须在请求广告前调用
*/
- (void)setIVRewardMode:(MTGIVRewardMode)ivRewardMode playRate:(CGFloat)playRate;
/**
* InterstitialVideo 奖励模式设置
*
* @param ivRewardMode {@link MTGIVRewardMode}获取受支持类型的列表
* @param playTime设置奖励alertView的时间,范围为0〜100s。
注意:在MTGIVRewardPlayMode中,playTime值指当播放达到设置的playTime时将出现奖励alertView。
在MTGIVRewardCloseMode中,playTime指单击关闭按钮时,如果视频播放时间小于设置的playTime,则会出现奖励alertView。
NOTE: 必须在请求广告前调用
*/
- (void)setIVRewardMode:(MTGIVRewardMode)ivRewardMode playTime:(NSInteger)playTime;
/**
* 如果要更改关闭广告二次确认弹窗文本,调用该方法
*
* @param title 弹窗标题
* @param content 弹窗内容
* @param ConfirmText 确认按钮文本
* @param cancelText 取消按钮文本
NOTE: 必须在请求广告前调用
*/
- (void)setAlertWithTitle:(NSString *_Nullable)title
content:(NSString *_Nullable)content
confirmText:(NSString *_Nullable)confirmText
cancelText:(NSString *_Nullable)cancelText;
获取Request ID
若广告展示过程中发现问题,可以通过该方法将 Request ID 记录并反馈到MTG.
需要在 load success 之后调用
Copy /**
* 在 onInterstitialAdLoadSuccess 回调之后调用,获取此次请求广告的requestId
*/
- (NSString *_Nullable)getRequestIdWithUnitId:(nonnull NSString *)unitId;
示例代码
Copy #import "MTGInsterstialVideoViewController.h"
#import <MTGSDKInterstitialVideo/MTGInterstitialVideoAdManager.h>
@interface MTGInsterstialVideoViewController ()<MTGInterstitialVideoDelegate>
//Demo InsterstialVideo View
@property (nonatomic, strong) UITextView *textView;
//Log Label
@property (nonatomic, strong) UILabel *logLabel;
@property (nonatomic,strong) MTGInterstitialVideoAdManager *ivAdManager;
@end
@implementation MTGInsterstialVideoViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
- (IBAction)initAdManagerButtonAction:(id)sender
{
if (!_ivAdManager) {
_ivAdManager = [[MTGInterstitialVideoAdManager alloc]initWithPlacementId:KInterstitialVideoPlacementId unitId:KInterstitialVideoUnitID delegate:self];
_ivAdManager.delegate = self;
}
}
- (IBAction)loadInsterstialButtonAction:(id)sender
{
if (!_ivAdManager) {
_ivAdManager = [[MTGInterstitialVideoAdManager alloc]initWithPlacementId:KInterstitialVideoPlacementId unitId:KInterstitialVideoUnitID delegate:self];
_ivAdManager.delegate = self;
// [_ivAdManager setAlertWithTitle:@"关闭?" content:@"确认关闭?" confirmText:@"关闭" cancelText:@"继续计时"];
// [_ivAdManager setIVRewardMode:MTGIVRewardPlayMode playTime:1];
// [_ivAdManager setIVRewardMode:MTGIVRewardCloseMode playRate:0.8];
}
[_ivAdManager loadAd];
}
- (IBAction)showInsterstialButtonAction:(id)sender
{
if (!_ivAdManager) {
_ivAdManager = [[MTGInterstitialVideoAdManager alloc]initWithPlacementId:KInterstitialVideoPlacementId unitId:KInterstitialVideoUnitID delegate:self];
_ivAdManager.delegate = self;
}
if ([_ivAdManager isVideoReadyToPlayWithPlacementId: KInterstitialVideoPlacementId unitId:KInterstitialVideoUnitID]) {
[_ivAdManager showFromViewController:self];
}
}
#pragma mark - Utility
#pragma mark - Interstitial Delegate Methods
//广告加载完成,但素材还未缓存完成
- (void) onInterstitialAdLoadSuccess:(MTGInterstitialVideoAdManager *_Nonnull)adManager{
[self log:NSStringFromSelector(_cmd)];
}
//广告素材缓存完成,达到可播放状态
- (void) onInterstitialVideoLoadSuccess:(MTGInterstitialVideoAdManager *_Nonnull)adManager{
[self log:NSStringFromSelector(_cmd)];
}
//广告加载失败
- (void) onInterstitialVideoLoadFail:(nonnull NSError *)error adManager:(MTGInterstitialVideoAdManager *_Nonnull)adManager;{
[self log:NSStringFromSelector(_cmd)];
}
//广告展示成功
- (void) onInterstitialVideoShowSuccess:(MTGInterstitialVideoAdManager *_Nonnull)adManager{
[self log:NSStringFromSelector(_cmd)];
}
//广告展示失败
- (void) onInterstitialVideoShowFail:(nonnull NSError *)error adManager:(MTGInterstitialVideoAdManager *_Nonnull)adManager{
[self log:NSStringFromSelector(_cmd)];
}
//广告被点击
- (void) onInterstitialVideoAdClick:(MTGInterstitialVideoAdManager *_Nonnull)adManager{
[self log:NSStringFromSelector(_cmd)];
}
/**
* 在取消展示广告后并将控件返回到您的应用时调用
* @param converted - BOOL 视频是否播放完整
*/
- (void)onInterstitialVideoAdDismissedWithConverted:(BOOL)converted adManager:(MTGInterstitialVideoAdManager *_Nonnull)adManager{
[self log:NSStringFromSelector(_cmd)];
}
//视频全部播放完成回调
- (void) onInterstitialVideoPlayCompleted:(MTGInterstitialVideoAdManager *_Nonnull)adManager {
[self log:NSStringFromSelector(_cmd)];
}
//广告结果页Endcard展示成功回调
- (void) onInterstitialVideoEndCardShowSuccess:(MTGInterstitialVideoAdManager *_Nonnull)adManager {
[self log:NSStringFromSelector(_cmd)];
}
//广告被关闭回调
- (void) onInterstitialVideoAdDidClosed:(MTGInterstitialVideoAdManager *_Nonnull)adManager{
[self log:NSStringFromSelector(_cmd)];
}
/**
*如果设置了iv奖励,您将收到此回调
*@param achieved 是否设置了播放进度监听
*@param alertWindowStatus {@link MTGIVAlertWindowStatus}支持的类型列表
注意:您可以根据该回调决定是否给予奖励
*/
- (void)onInterstitialVideoAdPlayVideo:(BOOL)achieved alertWindowStatus:(MTGIVAlertWindowStatus)alertWindowStatus adManager:(MTGInterstitialVideoAdManager *_Nonnull)adManager{
[self log:NSStringFromSelector(_cmd)];
}
@end
交互式广告接入
交互式广告是Mintegral推出的全新广告形态,通过该形式用户可以实际参与一个精心设计的交互广告(比如试玩一个游戏Demo),进而大大提升转化效果。当前广告内容以Playable为主。
注:该广告类型仅对部分开发者提供,如有需要请联系您的AM 或 致信developer@mintegral.com
广告效果示意:
导入头文件
Copy #import <MTGSDK/MTGSDK.h>
#import <MTGSDKInterActive/MTGInterActiveManager.h>
初始化MTGInterActiveManager
初始化MTGInterActiveManager,并且传入Placementid,UnitId,然后设置MTGInterActiveManager的delegate。
Copy - (nonnull instancetype)initWithPlacementId:(nullable NSString *)placementId
unitId:(nonnull NSString *)unitId
withViewController:(nonnull UIViewController *)viewController;
计时设置
注意:必须放在load方法前面才生效
Copy /**
* 如果要更改关闭广告二次确认弹窗文本,调用该方法
*
* @param title 弹窗标题
* @param content 弹窗内容
* @param ConfirmText 确认按钮文本
* @param cancelText 取消按钮文本
NOTE: 必须在请求广告前调用
*/
- (void)setAlertWithTitle:(NSString *_Nullable)title
content:(NSString *_Nullable)content
confirmText:(NSString *_Nullable)confirmText
cancelText:(NSString *_Nullable)cancelText;
获取Request ID
若广告展示过程中发现问题,可以通过该方法将 Request ID 记录并反馈到MTG
需要在 load success 之后调用
Copy /**
* 在onInterActiveLoadSuccess 回调之后调用,获取此次请求广告的requestId
*/
@property (nonatomic, readonly) NSString * _Nullable requestId;
请求广告和展示广告
Copy - (void)loadAd;
- (void)showFromViewController:(UIViewController *_Nonnull)viewController;
示例代码
Copy #import "MTGInterActiveViewController.h"
#import <MTGSDKInterActive/MTGInterActiveManager.h>
@interface MTGInterActiveViewController ()<MTGInterActiveDelegate>
@property (nonatomic, strong) MTGInterActiveManager *instersActiveAdManager;
@end
@implementation MTGInterActiveViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
- (IBAction)initAdManagerButtonAction:(id)sender
{
if (!_instersActiveAdManager) {
_instersActiveAdManager = [[MTGInterActiveManager alloc]initWithPlacementId:KInterActivePlacementId unitId:KInterActiveUnitID withViewController:self];
_instersActiveAdManager.delegate = self;
[self log:@"MTGInterActiveManager init"];
}
}
- (IBAction)loadInstersActiveButtonAction:(id)sender
{
if (!_instersActiveAdManager) {
_instersActiveAdManager = [[MTGInterActiveManager alloc]initWithPlacementId:KInterActivePlacementId unitId:KInterActiveUnitID withViewController:self];
_instersActiveAdManager.delegate = self;
}
[_instersActiveAdManager loadAd];
}
- (IBAction)showInstersActiveButtonAction:(id)sender
{
if (!_instersActiveAdManager) {
_instersActiveAdManager = [[MTGInterActiveManager alloc]initWithPlacementId:KInterActivePlacementId unitId:KInterActiveUnitID withViewController:self];
_instersActiveAdManager.delegate = self;
}
[_instersActiveAdManager showAd];
}
#pragma mark - instersActive Delegate Methods
//广告加载成功
- (void) onInterActiveLoadSuccess:(MTGInterActiveResourceType)resourceType adManager:(MTGInterActiveManager *_Nonnull)adManager{
[self log:[NSString stringWithFormat:@"rType:%d %@",(int)resourceType,NSStringFromSelector(_cmd)]];
}
//广告加载失败
- (void) onInterActiveLoadFailed:(nonnull NSError *)error adManager:(MTGInterActiveManager *_Nonnull)adManager{
[self log:error.description];
}
//广告展示成功
- (void) onInterActiveShowSuccess:(MTGInterActiveManager *_Nonnull)adManager{
[self log:NSStringFromSelector(_cmd)];
}
//广告展示失败
- (void) onInterActiveShowFailed:(nonnull NSError *)error adManager:(MTGInterActiveManager *_Nonnull)adManager{
[self log:NSStringFromSelector(_cmd)];
}
//广告被点击
- (void) onInterActiveAdClick:(MTGInterActiveManager *_Nonnull)adManager{
[self log:NSStringFromSelector(_cmd)];
}
//在取消展示广告后并将控件返回到您的应用时调用
- (void) onInterActiveAdDismissed:(MTGInterActiveManager *_Nonnull)adManager{
[self log:NSStringFromSelector(_cmd)];
}
//广告是否完整被播放回调
- (void) onInterActiveAdManager:(MTGInterActiveManager *)adManager playingComplete:(BOOL)completeOrNot {
NSString *des = [NSString stringWithFormat:@"finished playing or not : %@", @(completeOrNot)];
[self log:des];
}
@end
开屏广告接入
开屏式广告是目前比较流行的广告形式之一。这种类型比较适合投放电商、品牌类广告,流量接入上也很适合接入应用类流量。用户可以点击广告跳转到广告落地页,或者点击右上角的“跳过”按钮,跳转到app内容首页。开屏广告会在您的应用开启时加载,展示完毕后自动关闭并进入您的应用主界面。
分类 :开屏广告分为半屏和全屏,在半屏情况下,支持定义logo图片,同时也支持横竖屏。
广告效果示意:
导入头文件
Copy #import <MTGSDK/MTGSDK.h>
#import <MTGSDKSplash/MTGSplashAD.h>
初始化MTGSplashAD
初始化MTGSplashAD时,可以进行倒计时设置(传0时,为5s)、是否允许跳过设置(不设置时,默认为允许跳过)、半屏全屏设置(设置半屏时可自定义logo的视图大小)、横竖屏设置(传0时,取开发者当前的设备方向)
Copy /**
初始化 MTGSplashAD
@param placementId 广告版位ID。 您可以从后台创建。
@param unitId 广告单元的ID。 您可以从后台PlacementID下创建它。
@param countdown 广告展示倒计时,值为 2-10s.
@param allowSkip 是否允许跳过.
*/
- (instancetype)initWithPlacementID:(nullable NSString *)placementID
unitID:(NSString *)unitID
countdown:(NSUInteger)countdown
allowSkip:(BOOL)allowSkip;
/**
初始化MTGSplashAD方法的其他构造函数
@param placementId 广告版位ID。 您可以从后台创建。
@param unitId 广告单元的ID。 您可以从后台PlacementID下创建它。
@param countdown 广告展示倒计时,值为 2-10s
@param allowSkip 是否允许跳过
@param customViewSize 如果要在广告区域上显示自己的自定义视图,需要传入自定义视图的相应CGSize
@param preferredOrientation 方向设置
@note 1.在纵向模式下展示广告时,customViewSize的高度不应大于设备高度的25%
2.在横向模式下展示广告时,customViewSize的宽度不应大于设备宽度的25%
*/
- (instancetype)initWithPlacementID:(nullable NSString *)placementID
unitID:(NSString *)unitID
countdown:(NSUInteger)countdown
allowSkip:(BOOL)allowSkip
customViewSize:(CGSize)customViewSize
preferredOrientation:(MTGInterfaceOrientation)preferredOrientation;
注:customViewSize 的大小不能超过屏幕的 0.25
设置代理
Copy @property (nonatomic, weak) id <MTGSplashADDelegate> delegate;
背景图和背景颜色设置
Copy /* 在加载广告时显示您自己的背景图片 */
@property (nonatomic, strong) UIImage *backgroundImage;
/* 在加载广告时显示的背景色*/
@property (nonatomic, copy) UIColor *backgroundColor;
获取Request ID
若广告展示过程中发现问题,可以通过该方法将 Request ID 记录并反馈到MTG.
需要在 load success 之后调用
Copy /* 在splashADPreloadSuccess || splashADLoadSuccess 回调之后调用,获取此次请求广告的requestId*/
@property (nonatomic, readonly, copy) NSString *requestID;
我们提供两种请求展示广告方式:
1、(推荐)预先请求广告,再在合适的时机去展示广告
我们建议您在合适的时机调用preload,生命周期内preload时机最好不要距离show时间过长,建议不超过30分钟。调用preload后,在show场景时可以通过isADReadyToShow判断,如果为Yes则调用show。如果为No则调用loadAndShowInKeyWindow。
2、实时请求并展示广告
预先请求广告,再在合适的时机去展示广告
注:
展示广告前可以调用isADReadyToShow方法,来检测本地是否有缓存广告。
customView可传入自定义logo的视图,(customView的视图大小应该与初始化时设置的customViewSize大小一致,不一致时以customViewSize这个为logo试图预留的大小为准)
Copy /**
预加载广告然后调用`[MTGSplashAD showInKeyWindow:customView:]` 来展示广告
@note 请在主线程调用该方法
*/
- (void)preload;
/**
广告是否可展示
@return YES表示有一个可用的广告,否则为NO。
*/
- (BOOL)isADReadyToShow;
/**
如果有ready的广告,则可以调用此方法来展示广告。
@param window 必须是application的 key window
@param customView 显示您自己的自定义视图,例如logo
@note 您需要始终在主线程上调用此方法。
*/
- (void)showInKeyWindow:(UIWindow *)window customView:(nullable UIView *)customView;
实时请求并展示广告
timeout:SDK在指定时间内没有完成广告加载(即加载超时),则直接关闭。单位是ms。传0时,值为5000ms。
Copy /**
加载成功后显示广告
@param window 必须是application的 key window
@param customView 显示您自己的自定义视图,例如logo
@param timeout 加载超时,单位为毫秒。 如果传入0,则将默认为5000ms
@note 需要在主线程上调用此方法
*/
- (void)loadAndShowInKeyWindow:(UIWindow *)window
customView:(nullable UIView *)customView
timeout:(NSInteger)timeout;
每次preload都会刷新缓存。preload之后可以调用showInKeyWindow:customView,也可以调用showloadAndShowInKeyWindow:customView:timeout:,这两种都会优先使用preload之后的缓存。
MTGSplashAD回调
Copy /* 广告预加载成功 */
- (void)splashADPreloadSuccess:(MTGSplashAD *)splashAD;
/* 广告预加载失败 */
- (void)splashADPreloadFail:(MTGSplashAD *)splashAD error:(NSError *)error;
/* 广告加载成功 */
- (void)splashADLoadSuccess:(MTGSplashAD *)splashAD;
/* 广告加载失败 */
- (void)splashADLoadFail:(MTGSplashAD *)splashAD error:(NSError *)error;
/* 广告展示成功 */
- (void)splashADShowSuccess:(MTGSplashAD *)splashAD;
/* 广告展示失败 */
- (void)splashADShowFail:(MTGSplashAD *)splashAD error:(NSError *)error;
/* 当应用程序由于点击事件而即将离开时调用,调用此方法后不久,您的应用程序将移至后台。 */
- (void)splashADDidLeaveApplication:(MTGSplashAD *)splashAD;
/* 广告被点击*/
- (void)splashADDidClick:(MTGSplashAD *)splashAD;
/* 广告即将关闭 */
- (void)splashADWillClose:(MTGSplashAD *)splashAD;
/* 广告已经关闭 */
- (void)splashADDidClose:(MTGSplashAD *)splashAD;
/* 在剩余的倒计时更新时调用*/
- (void)splashAD:(MTGSplashAD *)splashAD timeLeft:(NSUInteger)time;
示例代码
Copy #import "MTGSplashAdViewController.h"
#import <MTGSDKSplash/MTGSplashAD.h>
#import <MTGSDK/MTGSDK.h>
@interface MTGSplashAdViewController () <MTGSplashADDelegate>
@property (nonatomic, strong) MTGSplashAD *splashAD;
@property (nonatomic, strong) UISwitch *useLogo;
@property (nonatomic, strong) UISwitch *skip;
- (void)createSplashAD {
if (self.useLogo.on) {
self.splashAD = [[MTGSplashAD alloc]initWithPlacementID:kSplashPlacementID unitID:kSplashUnitID countdown:10 allowSkip:self.skip.on customViewSize:CGSizeMake(200, 95) preferredOrientation:0];
} else {
self.splashAD = [[MTGSplashAD alloc]initWithPlacementID: kSplashPlacementID unitID:kSplashUnitID countdown:10 allowSkip:self.skip.on customViewSize:CGSizeZero preferredOrientation:0];
}
}
//Load Video
- (IBAction)preloadButtonAction:(id)sender{
[self createSplashAD];
[self log:@"splash ad is loading"];
[self.splashAD preload];
}
//isReady
- (void)isReadyButtonAction:(UIButton *)button {
[self createSplashAD];
BOOL ready = [self.splashAD isADReadyToShow];
[self log:[NSString stringWithFormat:@"isReady : %@", ready ? @"true" : @"false"]];
}
//Show Video
- (IBAction)showButtonAction:(id)sender
{
[self createSplashAD];
UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
UIView *logoView = nil;
if (self.useLogo.on) {
logoView = [self logoView];
}
[self.splashAD showInKeyWindow:keyWindow customView:logoView];
}
//LoadNShow
- (void)LoadNShowButtonAction:(UIButton *)btn {
[self createSplashAD];
UIView *logoView = nil;
if (self.useLogo.on) {
logoView = [self logoView];
}
[self log:@"splash ad is loading"];
UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
[self.splashAD loadAndShowInKeyWindow:keyWindow customView:logoView timeout:5000];
}
//logoView
- (UIView *)logoView {
UIImageView *logo = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logo"]];
logo.frame = CGRectMake(0, 0, 100, 100);
return logo;
}
#pragma mark - MTGSplashADDelegate
- (void)splashADPreloadSuccess:(MTGSplashAD *)splashAD {
[self log:[NSString stringWithFormat:@"unitId = %@, preload success", splashAD.unitID]];
}
- (void)splashADPreloadFail:(MTGSplashAD *)splashAD error:(NSError *)error {
[self log:[NSString stringWithFormat:@"unitId = %@, preload error : %@", splashAD.unitID, error]];
}
// 开屏广告素材加载成功
- (void)splashADLoadSuccess:(MTGSplashAD *)splashAD {
[self log:[NSString stringWithFormat:@"unitId = %@, load success", splashAD.unitID]];
}
// 开屏广告素材加载失败
- (void)splashADLoadFail:(MTGSplashAD *)splashAD error:(NSError *)error {
[self log:[NSString stringWithFormat:@"unitId = %@, load error : %@", splashAD.unitID, error]];
}
// 展示成功
- (void)splashADShowSuccess:(MTGSplashAD *)splashAD {
[self log:[NSString stringWithFormat:@"unitId = %@, show success", splashAD.unitID]];
}
// 展示失败
- (void)splashADShowFail:(MTGSplashAD *)splashAD error:(NSError *)error {
[self log:[NSString stringWithFormat:@"unitId = %@, show error : %@", splashAD.unitID, error]];
}
// 离开应用
- (void)splashADDidLeaveApplication:(MTGSplashAD *)splashAD {
[self log:[NSString stringWithFormat:@"unitId = %@, leave app", splashAD.unitID]];
}
// 点击
- (void)splashADDidClick:(MTGSplashAD *)splashAD {
[self log:[NSString stringWithFormat:@"unitId = %@, did click", splashAD.unitID]];
}
// 将要关闭
- (void)splashADWillClose:(MTGSplashAD *)splashAD {
[self log:[NSString stringWithFormat:@"unitId = %@, ad will close", splashAD.unitID]];
}
// 已经关闭
- (void)splashADDidClose:(MTGSplashAD *)splashAD {
[self log:[NSString stringWithFormat:@"unitId = %@, ad closed", splashAD.unitID]];
}
// 倒计时
- (void)splashAD:(MTGSplashAD *)splashAD timeLeft:(NSUInteger)time {
[self log:[NSString stringWithFormat:@"unitId = %@, ad countdown : %@", splashAD.unitID, @(time)]];
}
@end
Test ID
您在测试期间所获取的广告均为Mintegral的正式广告,因此会受到算法智能优化的影响,如果测试期间经常load失败返回EXCEPTION_RETURN_EMPTY,可使用以下测试id进行测试。
7c22942b749fe6a6e361b675e96b3ee9
常见问题
1、为什么要做preload?
答:preload预加载数据,提升load加载数据的效率,提升用户体验。
2、为什么广告第一次跳转很慢?
答:由于跳转过程中要跳好多次,所以第一次会比较慢,第二次有了点击缓存,会快很多。开发者可以在这个时间段设置Loading对话框。
3、为什么有时候拉取不到广告?
答:请查看AppId、AppKey、UnitId等信息是否填写正确,之后查看后台单子没有投放、投放状态是否正确。
4、为什么offer中出现了两种语言?
答:由于根据ip等信息判断区域,所以会返回对应区域的语言。又由于英文是通用语言,所以offer中会出现英文和对应区域的语言。
5、为什么有时候app下载不下来?
答:由于AppStore网络问题或者apple账号可能不是vpn去的国家,导致app不能下载。
6、广告源下发数量有多少?
答:某个地区的广告源数量为各个广告主想要投放此地区广告的数量总和,当请求的广告数超出此数量时,下发的广告数量以此地区广告数量总数为准。
7、Native广告图片缓存时间
答:Native广告图片的缓存时间为7天
接口状态返回说明
没有广告填充,可能导致的原因:1.您在测试期间所获取的广告均为Mintegral的正式广告,因此会受到算法智能优化的影响,若一段时间内大量加载和展示广告,可能导致一段时间后没有广告填充的现象。
appID和appKey不匹配,解决方案:检查APPkey和APPID是否填写正确,APPkey可以在应用设置(APP Setting)模块顶部获取
EXCEPTION_UNIT_NOT_FOUND_IN_APP
EXCEPTION_UNIT_ADTYPE_ERROR
EXCEPTION_UNIT_BIDDING_TYPE_ERROR
UnitID竞价模式和请求API不匹配,UnitID竞价模式一旦创建不可更改,需要重新创建新的UnitID
EXCEPTION_IV_RECALLNET_INVALIDATE
请求时的网络状态不对,一般是SDK初始化还未完成就去请求导致的
EXCEPTION_FILTER_BY_PLACEMENTID_INCONSISTENT
EXCEPTION_SERVICE_REQUEST_OS_VERSION_REQUIRED
无法取得osVersion,一般是GDPR开关导致的
kMTGErrorCodeUnknownError
kMTGErrorCodeRewardVideoFailedToLoadVideoData
kMTGErrorCodeRewardVideoFailedToLoadMd5Invalid
KMTGErrorCodeEmptyBidToken
kMTGErrorCodeNoAdsAvailableToPlay
kMTGErrorCodeFailedToLoad
kMTGErrorCodeFailedToShow
kMTGErrorCodeLoadAdsTimeOut
kMTGErrorCodeMaterialLoadFailed
kMTGErrorCodeNoSupportPopupWindow
欧盟GDPR版本须知:
接口介绍
1、弹出关于隐私政策的弹窗,此方法需在SDK初始化之前调用。
Copy - (void)showConsentInfoTips:(nullable void (^)(BOOL consentStatus, NSError *_Nullable error))callback;
示例代码:
Copy [[MTGSDK sharedInstance] showConsentInfoTips:^(BOOL consentStatus, NSError * _Nullable error) {
if (error == nil) {
BOOL status = consentStatus;
NSString * info = [NSString stringWithFormat: @"consentStatus = %d", status];
[self log:info];
_authorizationUserPrivate = YES;
}else{
[self log:error.localizedDescription];
}
}];
2、设置是否获取用户信息的开关,此方法也需要在SDK初始化之前调用
Copy - (void)setConsentStatus:(BOOL)agree;
示例代码:
Copy [[MTGSDK sharedInstance] setConsentStatus:YES];//表示用户同意收取信息
注意事项
1.如果不收集用户信息,将会影响广告投放,可能会引起没有广告返回的情况 ,请知悉。
2.对于欧盟用户,开发者集成时,建议在征得用户同意之前,先不要初始化SDK ,以免引起不必要的麻烦。
CCPA准备
2018年6月28日,美国加利福尼亚州(“加州”)颁布了《2018年加州消费者隐私法案》("CCPA"),旨在加强消费者隐私权和数据安全保护,将于2020年1月1日生效。对于加州用户,您可以基于用户的选择通过setDoNotTrackStatus接口进行设置。设置完成后,Mintegral将不再基于用户设备信息向该用户展示个性化推荐广告,也不会将该用户设备信息同步至其他第三方合作伙伴。该API在SDK版本5.8.7及以上已经提供。
接口介绍
设置是否获取用户信息的开关,此方法也需要在SDK初始化之前调用
Copy /**
If set to YES, the server will not display personalized ads based on the user's personal information
When receiving the user's request, and will not synchronize the user's information to other third-party partners.
Default is NO
*/
@property (nonatomic, assign) BOOL doNotTrackStatus;
示例代码
Copy [[MTGSDK sharedInstance] setDoNotTrackStatus:NO];
ChangeLog
RewardVideo 服务端回调支持开发者传递自定义参数
1.支持 SKAdImpression 归因 2.Bug fixed
1.优化banner卡顿问题;2. Bug fixed
1.新增对 SKAdNetwork v2.1 版本支持 2.性能优化
修复NativeAd 遗漏Impression回调的问题
1. 替换废弃API 2. 修复RewardVideo广告类型unitId传nil crash的问题
1、适配 ios14 放大视图模式 2、Bug fixed
基于sonar服务扫描后给出的优化建议,进行了代码优化
优化开屏广告 show 方法对开发者传入参数的限制
1.新增支持开发者获取requestId 2.SDK优化
1.优化GDPR,删除GDPR弹窗;2.优化支持iOS14,删除skoverlay;3.bug fixed.
适配 iOS 14,支持 SKNetwork 归因
1.RV 新增Reward Plus,奖励优化 2.NV支持播放完成回调 3.bid framework add reward plus 4.bug fixed
修复某些场景下偶现因丢失onVideoAdDismissed回调中的reward信息导致的崩溃
Banner Header Bidding模式取消自动刷新功能
1.升级GDPR 2.更新OMSDK(彻底移除OMSDK相关的以UIWebView命名的方法名) 3.MTGSDK不再支持XCode11以下版本archive 4.Bug fixed.
1.新增原生自动渲染广告类;2.Bug fixed
优化Header Bidding buyeruid参数
1、H5模板优化;2、打包 sdk 的 xcode 升级为9.2;3、新增支持 Splash 类型广告
1.IV新增奖励模式; 2.InterstitialVideo、RewardVideo、Interactive新增计时设置
1.Banner广告新增关闭回调API; 2.开发者提前销毁BannerAdView,内存释放优化
1. 为CCPA法案,MTGSDK类新增开发者设置doNotTrackStatu; 2. Bid接口添加idfv参数上报
1.Banner形式支持外部DSP流量;2.Banner内存性能优化(web及时释放)
1.移除UIWebView 2.兼容iOS 13.1 sk和xcode11.1
1.banner支持header bidding 2.bid framework新增bid request API
1.集成Open Measurement SDK 2.banner支持mraid expend
1.性能优化 2.新增Head-bidding功能
1.storekit优化 2.激励视频和插屏视频新增onVideoAdDidClosed 回调
1.storekit优化 2.解决已知的一些bug