MAXメディエーションネットワークの手動ダウンロード

リリースの更新情報を受け取るには、AppLovin-MAX-SDK-iOS GitHubリポジトリを購読してください。

最新のiOS SDKをダウンロードする

AppLovin SDKの統合

ダウンロードしたzipファイルには、AppLovinSDK.xcframeworkファイルが含まれています。 SDKをアプリケーションに追加するには、AppLovinSDK.xcframeworkファイルをXcodeプロジェクトにドラッグします。 Xcodeプロジェクトのターゲット設定のFrameworks, Libraries, and Embedded ContentセクションにAppLovinSDK.xcframeworkを含めてください。

Xcodeフラグの有効化

AppLovin SDKをコンパイルするには、-ObjCフラグを追加する必要があります。 -ObjCフラグを有効にするには、File > Project Settingsを選択し、Build Settingsに移動してOther Linker Flagsを検索し、**+**をクリックして-ObjCを追加します。

フレームワークの追加

プロジェクトに以下のフレームワークをリンクします。

  • AdSupport
  • AppTrackingTransparency
  • AudioToolbox
  • AVFoundation
  • CoreGraphics
  • CoreMedia
  • CoreMotion
  • CoreTelephony
  • Foundation
  • MessageUI
  • libz
  • SafariServices
  • StoreKit
  • SystemConfiguration
  • UIKit
  • WebKit

ad reviewの有効化

MAX Ad Reviewサービスを有効にするには、AppLovinQualityServiceSetup-ios.rbをダウンロードしてプロジェクトフォルダに移動します。 ターミナルウィンドウを開き、プロジェクトディレクトリにcdして以下を実行します。

ruby AppLovinQualityServiceSetup-ios.rb

SDKキーの追加

File > Project Settings > Infoを選択します。 Custom iOS Propertiesの行のいずれかをクリックし、**+**をクリックして新しい行を追加します。 新しい行のキーをAppLovinSdkKeyに、値をSDKキーに設定します。

SDKキーは、AppLovinダッシュボードのAccount > General > Keysセクションで確認できます。

SDKの初期化

SDK初期化設定の作成

SDKを初期化する前に、アプリデリゲートのapplication:applicationDidFinishLaunching:メソッド内でSDKの初期化設定オブジェクトを作成します。

この設定オブジェクトを使用すると、SDKが初期化される際のプロパティを設定できます。 これらの初期化プロパティは、アプリのライフサイクル中に変更可能なプロパティを含むALSdkSettingsを除き、不変(immutable)です。

// Create the initialization configuration
ALSdkInitializationConfiguration *initConfig = [ALSdkInitializationConfiguration configurationWithSdkKey: @"«SDK-key»" builderBlock:^(ALSdkInitializationConfigurationBuilder *builder) {

  builder.mediationProvider = ALMediationProviderMAX;

  // Perform any additional configuration/setting changes
}];

SDKキーは、AppLovinダッシュボードのAccount > General > Keysセクションで確認できます。

SDKの初期化

初期化設定オブジェクトを使用してAppLovin SDKを初期化します。 これは起動時に行ってください。 これにより、SDKがメディエーションネットワーク広告をキャッシュする時間を最大化でき、結果としてユーザーエクスペリエンスが向上します。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  // Create the initialization configuration
  ALSdkInitializationConfiguration *initConfig = [ALSdkInitializationConfiguration configurationWithSdkKey: @"«SDK-key»" builderBlock:^(ALSdkInitializationConfigurationBuilder *builder) {
    builder.mediationProvider = ALMediationProviderMAX;
  }];

  // Initialize the SDK with the configuration
  [[ALSdk shared] initializeWithConfiguration: initConfig completionHandler:^(ALSdkConfiguration *sdkConfig) {
    // Start loading ads
  }];
  ⋮

実装例

以下は統合のサンプルです。

// Create the initialization configuration
ALSdkInitializationConfiguration *initConfig = [ALSdkInitializationConfiguration configurationWithSdkKey: @"«SDK-key»" builderBlock:^(ALSdkInitializationConfigurationBuilder *builder) {
  builder.mediationProvider = ALMediationProviderMAX;
  builder.segmentCollection = [MASegmentCollection segmentCollectionWithBuilderBlock:^(MASegmentCollectionBuilder *builder) {
      [builder addSegment: [[MASegment alloc] initWithKey: @(849) values: @[@(1), @(3)]]];
  }];
}];

// Configure the SDK settings if needed before or after SDK initialization.
ALSdkSettings *settings = [ALSdk shared].settings;
settings.userIdentifier = @"«user-ID»";
[settings setExtraParameterForKey: @"uid2_token" value: @"«token-value»"];

// Note: you may also set these values in your Info.plist
settings.termsAndPrivacyPolicyFlowSettings.enabled = YES;
settings.termsAndPrivacyPolicyFlowSettings.termsOfServiceURL = [NSURL URLWithString: @"«https://your-company-name.com/terms-of-service»"];
settings.termsAndPrivacyPolicyFlowSettings.privacyPolicyURL = [NSURL URLWithString: @"«https://your-company-name.com/privacy-policy»"];

// Initialize the SDK with the configuration
[[ALSdk shared] initializeWithConfiguration: initConfig completionHandler:^(ALSdkConfiguration *sdkConfig) {
  // Start loading ads
}];

SKAdNetwork

統合手順については、SKAdNetworkドキュメントを参照してください。

インタースティシャル広告

インタースティシャル広告の読み込み

インタースティシャル広告を読み込むには、広告ユニットを使用してMAInterstitialAdオブジェクトをインスタンス化し、loadAd()を呼び出します。 広告の準備ができたときやその他の広告イベントの通知を受け取れるよう、MAAdDelegateを実装してください。

#import "ExampleViewController.h"
#import <AppLovinSDK/AppLovinSDK.h>

@interface ExampleViewController()<MAAdDelegate>
@property (nonatomic, strong) MAInterstitialAd *interstitialAd;
@property (nonatomic, assign) NSInteger retryAttempt;
@end

@implementation ExampleViewController

- (void)createInterstitialAd
{
  self.interstitialAd = [[MAInterstitialAd alloc] initWithAdUnitIdentifier: @"«ad-unit-ID»"];
  self.interstitialAd.delegate = self;

  // Load the first ad
  [self.interstitialAd loadAd];
}

#pragma mark - MAAdDelegate Protocol

- (void)didLoadAd:(MAAd *)ad
{
  // Interstitial ad is ready to be shown. '[self.interstitialAd isReady]' will now return 'YES'

  // Reset retry attempt
  self.retryAttempt = 0;
}

- (void)didFailToLoadAdForAdUnitIdentifier:(NSString *)adUnitIdentifier withError:(MAError *)error
{
  // Interstitial ad failed to load
  // AppLovin recommends that you retry with exponentially higher delays up to a maximum delay (in this case 64 seconds)

  self.retryAttempt++;
  NSInteger delaySec = pow(2, MIN(6, self.retryAttempt));

  dispatch_after(dispatch_time(DISPATCH_TIME_NOW, delaySec * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
    [self.interstitialAd loadAd];
  });
}

- (void)didDisplayAd:(MAAd *)ad {}

- (void)didClickAd:(MAAd *)ad {}

- (void)didHideAd:(MAAd *)ad
{
  // Interstitial ad is hidden. Pre-load the next ad
  [self.interstitialAd loadAd];
}

- (void)didFailToDisplayAd:(MAAd *)ad withError:(MAError *)error
{
  // Interstitial ad failed to display. AppLovin recommends that you load the next ad
  [self.interstitialAd loadAd];
}

@end

インタースティシャル広告の表示

インタースティシャル広告を表示するには、上記で作成したMAInterstitialAdオブジェクトでshowAd()を呼び出します。

if ( [self.interstitialAd isReady] )
{
  [self.interstitialAd showAd];
}

リワード広告

リワード広告の読み込み

リワード広告を読み込むには、リワード広告ユニットを使用してMARewardedAdオブジェクトを取得し、そのオブジェクトでloadAd()を呼び出します。 広告の準備ができたときやその他の広告イベントの通知を受け取れるよう、MARewardedAdDelegateを実装してください。

#import "ExampleViewController.h"
#import <AppLovinSDK/AppLovinSDK.h>

@interface ExampleViewController()<MARewardedAdDelegate>
@property (nonatomic, strong) MARewardedAd *rewardedAd;
@property (nonatomic, assign) NSInteger retryAttempt;
@end

@implementation ExampleViewController

- (void)createRewardedAd
{
  self.rewardedAd = [MARewardedAd sharedWithAdUnitIdentifier: @"«ad-unit-ID»"];
  self.rewardedAd.delegate = self;

  // Load the first ad
  [self.rewardedAd loadAd];
}

#pragma mark - MAAdDelegate Protocol

- (void)didLoadAd:(MAAd *)ad
{
  // Rewarded ad is ready to be shown. '[self.rewardedAd isReady]' will now return 'YES'

  // Reset retry attempt
  self.retryAttempt = 0;
}

- (void)didFailToLoadAdForAdUnitIdentifier:(NSString *)adUnitIdentifier withError:(MAError *)error
{
  // Rewarded ad failed to load
  // AppLovin recommends that you retry with exponentially higher delays up to a maximum delay (in this case 64 seconds)

  self.retryAttempt++;
  NSInteger delaySec = pow(2, MIN(6, self.retryAttempt));

  dispatch_after(dispatch_time(DISPATCH_TIME_NOW, delaySec * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
    [self.rewardedAd loadAd];
  });
}

- (void)didDisplayAd:(MAAd *)ad {}

- (void)didClickAd:(MAAd *)ad {}

- (void)didHideAd:(MAAd *)ad
{
  // Rewarded ad is hidden. Pre-load the next ad
  [self.rewardedAd loadAd];
}

- (void)didFailToDisplayAd:(MAAd *)ad withError:(MAError *)error
{
  // Rewarded ad failed to display. AppLovin recommends that you load the next ad
  [self.rewardedAd loadAd];
}

#pragma mark - MARewardedAdDelegate Protocol

- (void)didRewardUserForAd:(MAAd *)ad withReward:(MAReward *)reward
{
  // Rewarded ad was displayed and user should receive the reward
}

@end

リワード広告の表示

リワード広告を表示するには、上記で作成したMARewardedAdオブジェクトでshowAd()を呼び出します。

if ( [self.rewardedAd isReady] )
{
  [self.rewardedAd showAd];
}

バナー広告とMREC広告

バナー広告とMREC広告の読み込みと表示

広告を読み込むには、広告ユニットを使用してMAAdViewオブジェクトを作成し、loadAd()を呼び出します。 広告を表示するには、MAAdViewオブジェクトをビュー階層のサブビューとして追加します。 広告の準備ができたときやその他の広告イベントの通知を受け取れるよう、MAAdViewAdDelegateを実装してください。

#import "ExampleViewController.h"
#import <AppLovinSDK/AppLovinSDK.h>

@interface ExampleViewController()<MAAdViewAdDelegate>
@property (nonatomic, strong) MAAdView *adView;
@end

@implementation ExampleViewController

- (void)createBannerAd
{
  self.adView = [[MAAdView alloc] initWithAdUnitIdentifier: @"«ad-unit-ID»"];
  self.adView.delegate = self;

  // Banner height on iPhone and iPad is 50 and 90, respectively
  CGFloat height = (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) ? 90 : 50;

  // Stretch to the width of the screen for banners to be fully functional
  CGFloat width = CGRectGetWidth(UIScreen.mainScreen.bounds);

  self.adView.frame = CGRectMake(x, y, width, height);

  // Set background or background color for banner ads to be fully functional
  self.adView.backgroundColor = BACKGROUND_COLOR;

  [self.view addSubview: self.adView];

  // Load the ad
  [self.adView loadAd];
}

#pragma mark - MAAdDelegate Protocol

- (void)didLoadAd:(MAAd *)ad {}

- (void)didFailToLoadAdForAdUnitIdentifier:(NSString *)adUnitIdentifier withError:(MAError *)error {}

- (void)didClickAd:(MAAd *)ad {}

- (void)didFailToDisplayAd:(MAAd *)ad withError:(MAError *)error {}

#pragma mark - MAAdViewAdDelegate Protocol

- (void)didExpandAd:(MAAd *)ad {}

- (void)didCollapseAd:(MAAd *)ad {}

#pragma mark - Deprecated Callbacks

- (void)didDisplayAd:(MAAd *)ad { /* use this for impression tracking */ }
- (void)didHideAd:(MAAd *)ad { /* DO NOT USE - THIS IS RESERVED FOR FULLSCREEN ADS ONLY AND WILL BE REMOVED IN A FUTURE SDK RELEASE */ }

@end

バナーまたはMRECを非表示にするには、以下を呼び出します。

adView.hidden = YES;
[adView stopAutoRefresh];

バナーまたはMRECを表示するには、以下を呼び出します。

adView.hidden = NO;
[adView startAutoRefresh];

メディエーションネットワークの準備

統合する広告ネットワークを選択します。 その後、以下の具体的な手順に従ってください。

  • Amazon
  • Chartboost
  • DT Exchange
  • Google Ad Manager
  • Google Bidding and Google AdMob
  • HyprMX
  • InMobi
  • ironSource
  • Liftoff Monetize
  • Maio
  • Meta Audience Network
  • Mintegral
  • Pangle
  • Smaato
  • Unity Ads
  • Pangle iOSアダプターバージョン4.9.1.0.0以降、中国本土ではPangleを利用できなくなりました。 中国本土のトラフィックを収益化するには、CSJネットワークを設定し、CSJアダプターを追加してください。 中国本土を除くグローバルトラフィックについては、引き続きPangleを使用して収益化を行うことができます。

    Swiftビルド設定

    12.2未満のiOSバージョンでSwiftをサポートするには:

    1. Xcodeプロジェクトのメインターゲットで、File > Build Settingsを選択します。
    2. Always Embed Swift Standard LibrariesYesに設定します。

    設定: Always Embed Swift Standard Libraries。AppLovin MAX デモアプリ: Yes。

    App Delegateのwindowプロパティ

    App Delegateファイルのwindowプロパティを削除しないでください。 削除すると、InMobiのSDKがクラッシュする可能性があります。

    @property (nonatomic, strong) UIWindow *window;
    

    Meta Audience Networkのデータ処理オプション

    Limited Data Use(LDU)モードを有効にしない場合は、SetDataProcessingOptions()に空の配列を渡します。

    #import <FBAudienceNetwork/FBAudienceNetwork.h>
    ⋮
    [FBAdSettings setDataProcessingOptions: @[]];
    ⋮
    // Initialize MAX SDK
    

    ユーザーに対してLDUを有効にし、ユーザーの地域を指定するには、以下のようにSetDataProcessingOptions()を呼び出します。

    #import <FBAudienceNetwork/FBAudienceNetwork.h>
    ⋮
    [FBAdSettings setDataProcessingOptions: @[@"LDU"] country: «country» state: «state»];
    ⋮
    // Initialize MAX SDK
    

    Google UMPの使用

    CMPとしてGoogle UMPを使用している場合、ユーザーがMetaに同意したかどうかを判断できます。 そのためには、以下のようなコードを使用します。

    NSNumber *hasMetaConsent = [ALPrivacySettings additionalConsentStatusForIdentifier: 89];
    if ( hasMetaConsent )
    {
      BOOL consentGiven = hasMetaConsent.boolValue;
      // Set Meta Data Processing Options accordingly.
    }
    else
    {
      // AC String is not available on disk. Please check for consent status after the user completes the CMP flow.
    }
    

    カリフォルニア州のユーザーに対するMeta Audience Networkのデータ処理オプション

    カリフォルニア州におけるMeta Audience Networkの「Limited Data Use」フラグの実装方法については、Meta for Developersのドキュメントをお読みください。

    iOS 14.5以降に向けたMetaの準備

    Audience Network SDK 6.2.1では、以下の重要な要件が導入されています。

    • メディエーションの使用に関わらず、setAdvertiserTrackingEnabledフラグを実装します。 これにより、パーソナライズされた広告を配信するためにデータを使用できるかどうかがMetaに通知されます。
    • 広告主が広告キャンペーンの成果を測定できるよう、Metaが推奨するSKAdNetwork IDをXcodeプロジェクトのInfo.plistに追加します。 統合手順については、SKAdNetworkドキュメントを参照してください。
    [sdk initializeSdkWithCompletionHandler:^(ALSdkConfiguration *sdkConfiguration)
    {
       if ( @available(iOS 14.5, *) )
       {
         // Note that App transparency tracking authorization can be checked via `sdkConfiguration.appTrackingTransparencyStatus`
         // 1. Set Meta ATE flag here, THEN
       }
    
       // 2. Load ads
    }];
    

    Google AdSense、AdManager、またはAdMobを使用するデベロッパーおよびパブリッシャーは、Googleが認定した同意管理プラットフォーム(CMP)を使用する必要があります。 欧州経済領域(EEA)または英国のユーザーに広告を配信する場合、CMPはIABのTransparency and Consent Framework(TCF)と統合されている必要があります。 詳細については、プライバシー:「TCF v2同意」を参照してください。

    Google biddingおよびGoogle AdMob / Google Ad ManagerのアプリIDの追加

    アプリのInfo.plistGADApplicationIdentifierキーを追加します。 このキーに、Google biddingおよびGoogle AdMob / Google Ad ManagerのアプリIDの文字列値を設定します。

    GADApplicationIdentifier (String): «YOUR_ADMOB_APP_ID»

    Amazon SDKの初期化

    Amazon Publisher Services SDKは、MAX SDKの外部で初期化する必要があります。

    [[DTBAds sharedInstance] setAppKey: appId];
    [DTBAds sharedInstance].mraidCustomVersions = @[@"1.0", @"2.0", @"3.0"];
    [DTBAds sharedInstance].mraidPolicy = CUSTOM_MRAID;
    

    レポートの不一致を避けるため、最新のAmazon Publisher Servicesアダプターバージョンを使用してください。

    AmazonのSDKからバナーまたはMREC広告を読み込む

    Amazon広告をMAXに統合するには、まずAmazon広告を読み込む必要があります。 MAX広告を読み込む前に、DTBAdResponseまたはDTBAdErrorInfoMAAdViewのインスタンスに渡します。 これは、-[MAAdView setLocalExtraParameterForKey:value:]を呼び出すことで行えます。

    自動更新されるバナー広告の場合、広告の読み込みは1回だけで十分です。

    @interface ExampleViewController ()<DTBAdCallback>
    ⋮
    @end
    
    @implementation ExampleViewController
    
    - (void)viewDidLoad
    {
      [super viewDidLoad];
    
      NSString *amazonAdSlotId;
      MAAdFormat *adFormat;
    
      if ( UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad )
      {
        amazonAdSlotId = @"«Amazon-leader-slot-ID»";
        adFormat = MAAdFormat.leader;
      }
      else
      {
        amazonAdSlotId = @"«Amazon-banner-slot-ID»";
        adFormat = MAAdFormat.banner;
      }
    
      CGSize rawSize = adFormat.size;
      DTBAdSize *size = [[DTBAdSize alloc] initBannerAdSizeWithWidth: rawSize.width
                                                              height: rawSize.height
                                                         andSlotUUID: amazonAdSlotId];
    
      DTBAdNetworkInfo *adNetworkInfo = [[DTBAdNetworkInfo alloc] initWithNetworkName: DTBADNETWORK_MAX];
      DTBAdLoader *adLoader = [[DTBAdLoader alloc] initWithAdNetworkInfo: adNetworkInfo];
      [adLoader setAdSizes: @[size]];
      [adLoader loadAd: self];
    }
    
    - (void)onSuccess:(DTBAdResponse *)adResponse
    {
      // 'adView' is your instance of MAAdView
      [self.adView setLocalExtraParameterForKey: @"amazon_ad_response" value: adResponse];
      [self.adView loadAd];
    } 
    
    - (void)onFailure:(DTBAdError)error dtbAdErrorInfo:(DTBAdErrorInfo *)errorInfo
    {
      // 'adView' is your instance of MAAdView
      [self.adView setLocalExtraParameterForKey: @"amazon_ad_error" value: errorInfo];
      [self.adView loadAd];
    }
    
    @end
    

    AmazonのSDKからインタースティシャル広告を読み込む

    Amazonインタースティシャル広告をMAXに統合するには、まずAmazon広告を読み込む必要があります。 MAX広告を読み込む前に、DTBAdResponseまたはDTBAdErrorInfoMAInterstitialAdのインスタンスに渡します。 これは、-[MAInterstitialAd setLocalExtraParameterForKey:value:]を呼び出すことで行えます。

    AmazonのDTBAdResponseまたはDTBAdErrorInfoを読み込んでMAInterstitialAdインスタンスに渡す処理は、1セッションにつき1回のみ行う必要があります。

    #import <AppLovinSDK/AppLovinSDK.h>
    #import <DTBiOSSDK/DTBiOSSDK.h>
    
    @interface ExampleViewController ()<DTBAdCallback>
    ⋮
    @end
    
    @implementation ExampleViewController
    static MAInterstitialAd *interstitialAd;
    static BOOL isFirstLoad;
    
    + (void)initialize
    {
      [super initialize];
    
      interstitialAd = [[MAInterstitialAd alloc] initWithAdUnitIdentifier: @"«MAX-inter-ad-unit-ID»"];
      isFirstLoad = YES;
    }
    
    - (void)loadAd
    {
      // If first load - load ad from Amazon's SDK, then load ad for MAX
      if ( isFirstLoad )
      {
        isFirstLoad = NO;
    
        DTBAdNetworkInfo *adNetworkInfo = [[DTBAdNetworkInfo alloc] initWithNetworkName: DTBADNETWORK_MAX];
        DTBAdLoader *adLoader = [[DTBAdLoader alloc] initWithAdNetworkInfo: adNetworkInfo];
        [adLoader setAdSizes: @[
          [[DTBAdSize alloc] initInterstitialAdSizeWithSlotUUID: @"«Amazon-inter-slot-ID»"]
        ]];
        [adLoader loadAd: self];
      }
      else
      {
        [interstitialAd loadAd];
      }
    }
    
    - (void)onSuccess:(DTBAdResponse *)adResponse
    {
      // 'interstitialAd' is your instance of MAInterstitialAd
      [interstitialAd setLocalExtraParameterForKey: @"amazon_ad_response" value: adResponse];
      [interstitialAd loadAd];
    }
    
    - (void)onFailure:(DTBAdError)error dtbAdErrorInfo:(DTBAdErrorInfo *)errorInfo
    {
      // 'interstitialAd' is your instance of MAInterstitialAd
      [interstitialAd setLocalExtraParameterForKey: @"amazon_ad_error" value: errorInfo];
      [interstitialAd loadAd];
    }
    
    @end
    

    AmazonのSDKから動画インタースティシャル広告を読み込む

    Amazonインタースティシャル広告をMAXに統合するには、まずAmazon広告を読み込む必要があります。 MAX広告を読み込む前に、DTBAdResponseまたはDTBAdErrorInfoMAInterstitialAdのインスタンスに渡します。 これは、-[MAInterstitialAd setLocalExtraParameterForKey:value:]を呼び出すことで行えます。

    AmazonのDTBAdResponseまたはDTBAdErrorInfoを読み込んでMAInterstitialAdインスタンスに渡す処理は、1セッションにつき1回のみ行う必要があります。

    #import <AppLovinSDK/AppLovinSDK.h>
    #import <DTBiOSSDK/DTBiOSSDK.h>
    
    @interface ExampleViewController ()<DTBAdCallback>
    ⋮
    @end
    
    @implementation ExampleViewController
    static MAInterstitialAd *interstitialAd;
    static BOOL isFirstLoad;
    
    + (void)initialize
    {
      [super initialize];
    
      interstitialAd = [[MAInterstitialAd alloc] initWithAdUnitIdentifier: @"«MAX-inter-ad-unit-ID»"];
      isFirstLoad = YES;
    }
    
    - (void)loadAd
    {
      // If first load - load ad from Amazon's SDK, then load ad for MAX
      if ( isFirstLoad )
      {
        isFirstLoad = NO;
    
        DTBAdNetworkInfo *adNetworkInfo = [[DTBAdNetworkInfo alloc] initWithNetworkName: DTBADNETWORK_MAX];
        DTBAdLoader *adLoader = [[DTBAdLoader alloc] initWithAdNetworkInfo: adNetworkInfo];
    
        // Switch video player width and height values(320, 480) depending on device orientation
        [adLoader setAdSizes: @[
          [[DTBAdSize alloc] initVideoAdSizeWithPlayerWidth: 320 height: 480 andSlotUUID:@"«Amazon-video-inter-slot-ID»"]
        ]];
        [adLoader loadAd: self];
      }
      else
      {
        [interstitialAd loadAd];
      }
    }
    
    - (void)onSuccess:(DTBAdResponse *)adResponse
    {
      // 'interstitialAd' is your instance of MAInterstitialAd
      [interstitialAd setLocalExtraParameterForKey: @"amazon_ad_response" value: adResponse];
      [interstitialAd loadAd];
    }
    
    - (void)onFailure:(DTBAdError)error dtbAdErrorInfo:(DTBAdErrorInfo *)errorInfo
    {
      // 'interstitialAd' is your instance of MAInterstitialAd
      [interstitialAd setLocalExtraParameterForKey: @"amazon_ad_error" value: errorInfo];
      [interstitialAd loadAd];
    }
    
    @end
    

    AmazonのSDKからリワード動画広告を読み込む

    Amazonリワード動画をMAXに統合するには、まずAmazon広告を読み込む必要があります。 MAX広告を読み込む前に、DTBAdResponseまたはDTBAdErrorInfoMARewardedAdのインスタンスに渡します。 これは、-[MARewardedAd setLocalExtraParameterForKey:value:]を呼び出すことで行えます。

    AmazonのDTBAdResponseまたはDTBAdErrorInfoを読み込んでMARewardedAdインスタンスに渡す処理は、1回のみ行う必要があります。

    #import <AppLovinSDK/AppLovinSDK.h>
    #import <DTBiOSSDK/DTBiOSSDK.h>
    
    @interface ExampleViewController ()<DTBAdCallback>
    ⋮
    @end
    
    @implementation ExampleViewController
    static MARewardedAd *rewardedAd;
    static BOOL isFirstLoad;
    
    + (void)initialize
    {
      [super initialize];
    
      rewardedAd = [MARewardedAd sharedWithAdUnitIdentifier: @"«MAX-rewarded-ad-unit-ID»"];
      isFirstLoad = YES;
    }
    
    - (void)loadAd
    {
      // If first load - load ad from Amazon's SDK, then load ad for MAX
      if ( isFirstLoad )
      {
        isFirstLoad = NO;
    
        DTBAdNetworkInfo *adNetworkInfo = [[DTBAdNetworkInfo alloc] initWithNetworkName: DTBADNETWORK_MAX];
        DTBAdLoader *adLoader = [[DTBAdLoader alloc] initWithAdNetworkInfo: adNetworkInfo];
    
        // Switch video player width and height values(320, 480) depending on device orientation
        [adLoader setAdSizes: @[
          [[DTBAdSize alloc] initVideoAdSizeWithPlayerWidth: 320 height: 480 andSlotUUID:@"«Amazon-video-rewarded-slot-ID»"]
        ]];
        [adLoader loadAd: self];
      }
      else
      {
        [rewardedAd loadAd];
      }
    }
    
    - (void)onSuccess:(DTBAdResponse *)adResponse
    {
      // 'rewardedAd' is your instance of MARewardedAd
      [rewardedAd setLocalExtraParameterForKey: @"amazon_ad_response" value: adResponse];
      [rewardedAd loadAd];
    }
    
    - (void)onFailure:(DTBAdError)error dtbAdErrorInfo:(DTBAdErrorInfo *)errorInfo
    {
      // 'rewardedAd' is your instance of MARewardedAd
      [rewardedAd setLocalExtraParameterForKey: @"amazon_ad_error" value: errorInfo];
      [rewardedAd loadAd];
    }
    
    @end
    

    Amazon Publisher Servicesのテスト

    AppLovinでは、AmazonのSDKでテストモードを有効にすることを推奨しています。 これにより、テスト広告を受け取ることができます。 テストモードを有効にするには、以下のコールを行います。

    [[DTBAds sharedInstance] setLogLevel: DTBLogLevelAll];
    [[DTBAds sharedInstance] setTestMode: YES];
    

    ウォーターフォールをフィルタリングして、Amazon広告のみを含めることができます。 これを行うには、Mediation DebuggerSelect Live Networkに移動し、Amazonネットワークを選択します。

    App Transport Securityの無効化

    App Transport Security(ATS)を無効にするには、アプリのInfo.plistNSAppTransportSecurityを追加します。 次に、キーNSAllowsArbitraryLoadsを追加し、そのBoolean値をYESに設定します。 このキーのみが存在することを確認してください。

    App Transport Security Settings (Dictionary): 1 item. Allow Arbitrary Loads (Boolean): YES.

    SKAdNetwork

    統合手順については、SKAdNetworkドキュメントを参照してください。

    MAXメディエーションネットワークの手動ダウンロード

    読み込み中...

    search