404 Not Found


nginx
404 Not Found

404 Not Found


nginx
404 Not Found

404 Not Found


nginx
404 Not Found

404 Not Found


nginx

1、概述

1.1面向人群

本产品主要面向需要在iOS产品中接入玉米移动广告SDK的开发人员。

1.2开发环境

Xcode 7.0 或更高版本

部署目标为 iOS 8.0 或更高版本

2、SDK下载

2.1三方SDK 选择

2.2玉米SDK下载

请下载玉米SDK并将其添加到您的工程中。

DownLoad SDK v2.0.5

2.3三方SDK下载

请下载三方SDK,并根据各三方平台说明将其添加到您的工程中。

3、开发环境配置

3.1 App Transport Security

WWDC 15 提出的 ATS (App Transport Security) 是 Apple 在推进网络通讯安全的一个重要方式。在 iOS 9 及以上版本中,默认非 HTTPS 的网络访问是被禁止的。

因为大部分广告物料以 HTTP 形式提供,为提高广告填充率,请进行以下设置:

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

当 NSAllowsArbitraryLoads 和 NSAllowsArbitraryLoadsInWebContent 或 NSAllowsArbitraryLoadsForMedia同时存在时,根据系统不同,表现的行为也会不一样。简单说,iOS 9 只看 NSAllowsArbitraryLoads,而 iOS 10 会优先看 InWebContent 和ForMedia 的部分。在 iOS 10 中,要是后两者存在的话,在相关部分就会忽略掉NSAllowsArbitraryLoads;如果不存在,则遵循 NSAllowsArbitraryLoads 的设定。

3.2 iOS 9 及以上系统相关权限

应用程序上传 App Store, 请在 info.plist 文件中添加以下权限。

 <-- 日历 -->
<key>NSCalendarsUsageDescription</key>
<string>App需要您的同意,才能访问日历</string>
<!-- 相册 -->
<key>NSPhotoLibraryUsageDescription</key>
<string>App需要您的同意,才能访问相册</string>

4、接入方式

4.1 CocoaPods (推荐)

CocoaPods 是 iOS 的依赖管理工具,使用它可以轻松管理 YumiMediationSDK。

打开您工程的 Podfile,选择下面其中一种方式添加到您应用的 target。

如果您是初次使用 CocoaPods,请查阅 CocoaPods Guides

1.如果您只需要 YumiMediationSDK

pod "YumiMediationSDK"

2.如果您需要聚合其他平台

pod "YumiMediationAdapters", :subspecs =>
['AdColony','AdMob','AppLovin','Baidu','Chartboost','Domob','Facebook','GDT','InMobi','IronSource','StartApp','Unity','Vungle','PlayableAds','Centrixlink','Mobvista']

接下来再命令行界面中运行:

$ pod install --repo-update

最终通过 workspace 打开工程。

4.2 手动集成 YumiMediationSDK

1.三方 SDK 选择

2.三方 SDK 下载

3.YumiMediationSDK 下载

4.添加 YumiMediationSDK 到您的工程

5.配置脚本

按照如图所示步骤,添加 YumiMediationSDKConfig.xcconfig

6. 导入 Framework

导入如果所示的系统动态库。

5、代码集成示例

5.1 广告形式

Banner

初始化及请求横幅

#import <YumiMediationSDK/YumiMediationBannerView.h>
@interface ViewController ()<YumiMediationBannerViewDelegate>
@property (nonatomic) YumiMediationBannerView *yumiBanner;
@end
@implementation ViewController
//init yumiBanner
- (void)viewDidLoad {
    [super viewDidLoad];
    self.yumiBanner = [[YumiMediationBannerView alloc]initWithPlacementID:@"YourPlacementID"
                                               channelID:@"Your ChannelID" 
                                               versionID:@"Your VersionNumber"                              
position:YumiMediationBannerPositionBottom 
                                               rootViewController:self];
    self.yumiBanner.delegate = self;
    [self.yumiBanner loadAd:YES];
    [self.view addSubview:self.yumiBanner];
}
@end

设置 Banner尺寸

//目前我们支持三种尺寸
//在iPhone上默认为320*50,如无调整不需设置下列代码。
//在ipad上默认为728*90,如无调整不需设置下列代码。
//如果您有特殊需求,320*250为可选项,请在loadAd之前,执行下列代码。
self.yumiBanner.bannerSize = kYumiMediationAdViewBanner300x250;

移除 Banner

 //remove yumiBanner
- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    if (_yumiBanner) {
        [_yumiBanner removeFromSuperview];
        _yumiBanner = nil;
    }
}

实现代理方法

 //implementing yumiBanner delegate
- (void)yumiMediationBannerViewDidLoad:(YumiMediationBannerView *)adView{
    NSLog(@"adViewDidReceiveAd");
}
- (void)yumiMediationBannerView:(YumiMediationBannerView *)adView didFailWithError:(YumiMediationError *)error{
    NSLog(@"adView:didFailToReceiveAdWithError: %@", error);
}
- (void)yumiMediationBannerViewDidClick:(YumiMediationBannerView *)adView{
    NSLog(@"adViewDidClick");
}

自适应功能

- (void)loadAd:(BOOL)isSmartBanner;

您在请求 banner 广告的同时可以设置是否开启自适应功能。

如果设置 isSmartBanner 为 YES ,YumiMediationBannerView 将会自动根据设备的尺寸进行适配。

此时您可以通过下面的方法获取 YumiMediationBannerView 的尺寸。

 - (CGSize)fetchBannerAdSize;
  • 非自适应
  • 自适应

Interstitial

初始化及请求插屏

 #import <YumiMediationSDK/YumiMediationInterstitial.h>
@interface ViewController ()<YumiMediationInterstitialDelegate>
@property (nonatomic) YumiMediationInterstitial *yumiInterstitial;
@end
@implementation ViewController
//init yumiInterstitial
- (void)viewDidLoad {
    [super viewDidLoad];
    self.yumiInterstitial =  [[YumiMediationInterstitial alloc] 
                              initWithPlacementID:@"Your PlacementID"
                                        channelID:@"Your channelID"
                                        versionID:@"Your versionID"
                               rootViewController:self];
    self.yumiInterstitial.delegate = self;
}
@end

展示插屏

//present YumiMediationInterstitial
- (IBAction)presentYumiMediationInterstitial:(id)sender {
    if ([self.yumiInterstitial isReady]) {
        [self.yumiInterstitial present];
  } else {
        NSLog(@"Ad wasn't ready");
  }
}

实现代理方法

 //implementing YumiMediationInterstitial Delegate
- (void)yumiMediationInterstitialDidReceiveAd:(YumiMediationInterstitial *)interstitial{
    NSLog(@"interstitialDidReceiveAd");
}
- (void)yumiMediationInterstitial:(YumiMediationInterstitial *)interstitial
                 didFailWithError:(YumiMediationError *)error{
    NSLog(@"interstitial:didFailToReceiveAdWithError: %@", error)
}
- (void)yumiMediationInterstitialWillDismissScreen:(YumiMediationInterstitial *)interstitial{
    NSLog(@"interstitialWillDismissScreen");
}
- (void)yumiMediationInterstitialDidClick:(YumiMediationInterstitial *)interstitial{
    NSLog(@"interstitialDidClick");
}

Rewarded Video

初始化及请求视频

#import <YumiMediationSDK/YumiMediationVideo.h>
@implementation ViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    [[YumiMediationVideo sharedInstance] loadAdWithPlacementID:@"Your PlacementID" 
                                                     channelID:@"Your channelID" 
                                                     versionID:@"Your versionID"];
    [YumiMediationVideo sharedInstance].delegate = self;
}
@end

展示视频

 
- (IBAction)presentYumiMediationVideo:(id)sender {
    if ([[YumiMediationVideo sharedInstance] isReady]) {
         [[YumiMediationVideo sharedInstance] presentFromRootViewController:self];
  } else {
        NSLog(@"Ad wasn't ready");
  }
}

实现代理方法

- (void)yumiMediationVideoDidOpen:(YumiMediationVideo *)video{
    NSLog(@"Opened reward video ad.");
}
- (void)yumiMediationVideoDidStartPlaying:(YumiMediationVideo *)video{
    NSLog(@"Reward video ad started playing.");
}
- (void)yumiMediationVideoDidClose:(YumiMediationVideo *)video{
    NSLog(@"Reward video ad is closed.");
}
- (void)yumiMediationVideoDidReward:(YumiMediationVideo *)video{
    NSLog(@"is Reward");
}

Splash

初始化及展示开屏

为了保证开屏的展示,我们推荐尽量在 App 启动时开始执行下面的方法。

例如:在您 AppDelegate 的 application:didFinishLaunchingWithOptions: 方法中。

#import <YumiMediationSDK/YumiAdsSplash.h>

展示全屏广告

//appKey 为预留字段,可填空字符串。
[[YumiAdsSplash sharedInstance] showYumiAdsSplashWith:@"Your PlacementID"
                                               appKey:@"nullable" 

展示半屏广告

//appKey 为预留字段,可填空字符串。
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, [UIScreen mainScreen].bounds.size.height-100,
        [UIScreen mainScreen].bounds.size.width, 100)]; 
view.backgroundColor = [UIColor redColor];
//view is your customView.You can show your logo there.
//warning:view's frame is nonnull.
[[YumiAdsSplash sharedInstance] showYumiAdsSplashWith:@"Your PlacementID" 
                                               appKey:@"nullable" 
                                     customBottomView:view
                                   rootViewController:self.window.rootViewController 
                                             delegate:self];

实现代理方法

- (void)yumiAdsSplashDidLoad:(YumiAdsSplash *)splash{
    NSLog(@"yumiAdsSplashDidLoad.");
}
- (void)yumiAdsSplash:(YumiAdsSplash *)splash DidFailToLoad:(NSError *)error{
    NSLog(@"yumiAdsSplash:DidFailToLoad: %@", error)
}
- (void)yumiAdsSplashDidClicked:(YumiAdsSplash *)splash{
    NSLog(@"yumiAdsSplashDidClicked.");
}
- (void)yumiAdsSplashDidClosed:(YumiAdsSplash *)splash{
    NSLog(@"yumiAdsSplashDidClosed.");
}
- (nullable UIImage *)yumiAdsSplashDefaultImage{
    return UIImage;//Your default image when app start
}

Native

初始化及请求

#import <YumiMediationSDK/YumiMediationNativeAd.h>>
@interface ViewController ()<YumiMediationNativeAdDelegate>
@property (nonatomic) YumiMediationNativeAd *yumiNativeAd;
@end
@implementation ViewController
- (void)viewDidLoad {
    [super viewDidLoad];
     self.yumiNativeAd = [[YumiMediationNativeAd alloc] 
                                            initWithPlacementID:@"Your PlacementID" 
                                                      channelID:@"Your channelID" 
                                                      versionID:@"Your versionID"];
     self.yumiNativeAd.delegate = self;
     [self.nativeAd loadAd:1];//You can request more than one ad.
}
@end

Register View

/**
 注册用来渲染广告的 View
 - Parameter view: 渲染广告的 View.
 - Parameter viewController: 将用于当前的ui SKStoreProductViewController(iTunes商店产品信息)或   应用程序的浏览器。
 整个渲染区域可点击。
 */
- (void)registerViewForInteraction:(UIView *)view
                withViewController:(nullable UIViewController *)viewController
                          nativeAd:(YumiMediationNativeModel *)nativeAd;

Report Impression

/**
 当原生广告被展示时调用此方法
 - Parameter nativeAd: 将要被展示的广告对象.
 - Parameter view: 用来渲染广告的 View.
*/
- (void)reportImpression:(YumiMediationNativeModel *)nativeAd view:(UIView *)view;

实现代理方法

/// Tells the delegate that an ad has been successfully loaded.
- (void)yumiMediationNativeAdDidLoad:(NSArray<YumiMediationNativeModel *> *)nativeAdArray{
    NSLog(@"Native Ad Did Load.");
}
/// Tells the delegate that a request failed.
- (void)yumiMediationNativeAd:(YumiMediationNativeAd *)nativeAd didFailWithError:(YumiMediationError *)error{
    NSLog(@"NativeAd Did Fail With Error.");
}
​
/// Tells the delegate that the Native view has been clicked.
- (void)yumiMediationNativeAdDidClick:(YumiMediationNativeModel *)nativeAd{
    NSLog(@"Native Ad Did Click.");
}

6、调试模式

如果您想调试平台key是否有广告返回,可选择调试模式。

调用调试模式之前,请保证您的 app 已经初始化 YumiMediationSDK 。

6.1、接入方式

CocoaPods(推荐)

pod "YumiMediationDebugCenter-iOS" 

手动方式

将下载好的YumiMediationDebugCenter-iOS.framework加入Xcode工程即可。

6.2、调用调试模式

#import <YumiMediationDebugCenter-iOS/YumiMediationDebugController.h>
[[YumiMediationDebugController sharedInstance]
        presentWithBannerPlacementID:@"Your BannerPlacementID"
        interstitialPlacementID:@"Your interstitialPlacementID"
        videoPlacementID:@"Your videoPlacementID"
        nativePlacementID:@"Your nativePlacementID"
        channelID:@"Your channelID"
        versionID:@"Your versionID"
        rootViewController:self];//your rootVC

6.3、图示

选择平台类型

选择单一平台,灰色平台为已添加未配置

选择广告类型,调试单一平台

404 Not Found

404 Not Found


nginx
404 Not Found

404 Not Found


nginx