ドキュメント

​
​

Development

User Acquisition

Monetization

産業

Unity Ads Monetization

Unity Ads Android SDK

Unity Ads iOS SDK

Unity Ads SDK

Unity Ads Monetization

Unity Ads Monetization
​
​
iOS 開発者ガイド
  • iOS SDK の概要
  • インテグレーションの要件
  • iOS 用 Unity Ads SDK のインストール
  • iOS での SDK の初期化
  • iOS でのインタースティシャル広告の実装
  • iOS でのリワード広告の実装
  • iOS でのバナー広告の実装
iOS 14 のインテグレーション
  • iOS 14 のテクニカルインテグレーション
  • iOS 14 用 Unity Ads SDK の更新
  • iOS 14 サポートパッケージのインストール
  • 広告ネットワーク ID の設定
  • App Tracking Transparency への準拠
iOS SDK API リファレンス
  • Unity Ads for iOS API リファレンス (Objective-C)
  1. ゲームの成長
  2. Unity Ads
  3. iOS 開発者向け Unity Ads SDK インテグレーションガイド

iOS でのバナー広告の実装

iOS アプリケーションにバナー広告を実装します。ビュー階層内でバナービューオブジェクトを作成および表示し、デリゲートを使用して広告イベントを管理します。
読み終わるまでの所要時間 6 分
最終更新 3日前

重要
app-ads.txt は、詐欺に対処し広告エコシステムに透明性をもたらす IAB イニシアチブです。記載されているとおりに app-ads.txt を実装してください。そうしないと、バナーの需要が大幅に減るおそれがあります。
バナー広告には、特定のタイプのバナー専用広告ユニットが必要です。
他のビューと同様に、バナービューオブジェクトはビュー階層に配置できます。これにより、各バナーインスタンスの位置をカスタマイズしたり、複数のバナーを表示したりできます。
注
Apple のガイドライン に記載されているように、バナーコンテンツはセーフエリア外ではレンダリングされません。

スクリプトの実装

ViewController
実装 (
.m
) にバナーコードを追加します。以下のスクリプトサンプルは、画面に 2 つのバナー広告を表示するための実装例です。参照されているクラスの詳細については、
UADSBannerView
API のセクションを参照してください。

MREC バナー形式の実装

注
バナー広告を表示する前に、Unity Ads を 初期化 する必要があります。
アプリでミディアムレクタングル (MREC) サイズの広告フォーマットを表示するには、300 x 250、300 x 300、450 x 450 など、適切なサイズを使用する必要があります。具体的には、300 x 250 の MREC バナー広告の場合、以下のコード例のサイズを
CGSizeMake(320, 50)
以下の調整されたサイズに置き換えます。
CGSizeMake(300, 250)

バナー広告の例

@interface ViewController () <UADSBannerViewDelegate>​​// これはバナー広告を表示する広告ユニットまたはプレースメントです: @property (strong) NSString* placementId;// このバナービューオブジェクトは画面の上部に配置されます: @property (strong, nonatomic) UADSBannerView *topBannerView;// このバナービューオブジェクトは画面の下部に配置されます: @property (strong, nonatomic) UADSBannerView *bottomBannerView;​​@end​​@implementation ViewController​​- (void)viewDidLoad { [super viewDidLoad]; self.placementId = @"banner"; [UnityAds initialize: @"1234567" testMode: YES initializationDelegate: self];}​​// 上部のバナービューオブジェクトを作成およびロードするメソッドの例: - (void)loadTopBanner{ // Instantiate a banner view object with the Ad Unit ID and size: self.topBannerView = [[UADSBannerView alloc] initWithPlacementId: _placementId size: CGSizeMake(320, 50)]; // Set the banner delegate for event callbacks: self.topBannerView.delegate = self; // Add the banner view object to the view hierarchy: [self addBannerViewToTopView:self.topBannerView]; // Load ad content to the banner view object: [_topBannerView load];}​​// 下部のバナービューオブジェクトを作成およびロードするメソッドの例: - (void)loadBottomBanner{ self.bottomBannerView = [[UADSBannerView alloc] initWithPlacementId: _placementId size: CGSizeMake(320, 50)]; self.bottomBannerView.delegate = self; [self addBannerViewToBottomView:self.bottomBannerView]; [_bottomBannerView load];}​​// Example method for discarding the top banner view object (for example, if there's no fill): - (void)unLoadTopBanner{ // Remove the banner view object from the view hierarchy: [self.topBannerView removeFromSuperview]; // Set it to nil: _topBannerView = nil;}​​// 下部のバナービューオブジェクトを破棄するメソッドの例: - (void)unLoadBottomBanner{ [self.bottomBannerView removeFromSuperview]; _bottomBannerView = nil;}​​​// 上部のバナービューオブジェクトを配置するメソッドの例: - (void)addBannerViewToTopView:(UIView *)bannerView { bannerView.translatesAutoresizingMaskIntoConstraints = NO; [self.view addSubview:bannerView]; [self.view addConstraints:@[ [NSLayoutConstraint constraintWithItem:bannerView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom multiplier:1 constant:0], [NSLayoutConstraint constraintWithItem:bannerView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterX multiplier:1 constant:0] ]];}​// Example method for placing the bottom banner view object:- (void)addBannerViewToBottomView: (UIView *)bannerView { bannerView.translatesAutoresizingMaskIntoConstraints = NO; [self.view addSubview:bannerView]; [self.view addConstraints:@[ [NSLayoutConstraint constraintWithItem:bannerView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.bottomLayoutGuide attribute:NSLayoutAttributeTop multiplier:1 constant:0], [NSLayoutConstraint constraintWithItem:bannerView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterX multiplier:1 constant:0] ]];}​// Implement the delegate methods:#pragma mark :UADSBannerViewDelegate- (void)bannerViewDidLoad:(UADSBannerView *)bannerView { // Called when the banner view object finishes loading an ad. NSLog(@"Banner loaded for Ad Unit or Placement: %@", bannerView.placementId);}- (void)bannerViewDidClick:(UADSBannerView *)bannerView { // Called when the banner is clicked. NSLog(@"Banner was clicked for Ad Unit or Placement: %@", bannerView.placementId);}- (void)bannerViewDidLeaveApplication:(UADSBannerView *)bannerView { // Called when the banner links out of the application.}- (void)bannerViewDidError:(UADSBannerView *)bannerView error:(UADSBannerError *)error{ // Called when an error occurs showing the banner view object. NSLog(@"Banner encountered an error for Ad Unit or Placement: %@ with error message %@", bannerView.placementId, [error localizedDescription]); // Note that the UADSBannerError can indicate no fill (refer to the API documentation).}@end
次のステップ: 収益化戦略 ガイドを確認し、実装をテスト します。

Copyright © 2026 Unity Technologies
法規事項プライバシーポリシークッキーDocumentation Terms of Use私の個人情報を販売または共有しないプライバシーに関する選択 (クッキー設定)

"Unity" の名称、Unity のロゴ、およびその他の Unity の商標は、米国およびその他の国における Unity Technologies またはその関係会社の商標または登録商標です (詳しくはこちら)。その他の名称またはブランドは該当する所有者の商標です。

一部のページは利便性向上のため機械翻訳を使用しており、内容に不正確な表現が含まれる場合があります。内容に齟齬または不一致が生じた場合は、英語版を正本とします。

  • このページ
    • スクリプトの実装

      • MREC バナー形式の実装

        • バナー広告の例


このページの問題を報告する