-
Notifications
You must be signed in to change notification settings - Fork 6
Implementation for fullscreen ads
Please refer to the link below if you have not downloaded the SDK or created an ad space.
If you have not added the SDK into the Project, please add it by the following methods.
First, load the ad using NADFullBoardLoader.
Swift
import UIKit
import NendAd
class ViewController: UIViewController {
private var adLoader: NADFullBoardLoader!
private var ad: NADFullBoard? // An instance of a fullBoard Ad
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.adLoader = NADFullBoardLoader(spotID: spotID, apiKey: "apiKey")
}
private func loadFullBoardAd() {
self.adLoader.loadAd { [weak self] (ad: NADFullBoard?, error: NADFullBoardLoaderError) in
guard let `self` = self else { return }
if let fullBoardAd = ad {
self.ad = fullBoardAd
} else {
switch (error) {
case .failedAdRequest:
print("The ad request failed.")
break
case .failedDownloadImage:
print("Failed to download ad images.")
break
case .invalidAdSpaces:
print("An inventory that is not available for fullBoard ads has been specified.")
break
default:
break
}
}
}
}
}Objective-C
#import <NendAd/NADFullBoardLoader.h>
@interface ViewController : UIViewController
@property (nonatomic, strong) NADFullBoardLoader *loader;
@property (nonatomic, strong) NADFullBoard *ad;
@end
...
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
...
self.loader = [[NADFullBoardLoader alloc] initWithSpotID:spotID apiKey:@"apiKey"];
}
- (void)loadFullBoardAd
{
__weak typeof(self) weakSelf = self;
[self.loader loadAdWithCompletionHandler:^(NADFullBoard *ad, NADFullBoardLoaderError error) {
if (ad) {
weakSelf.ad = ad;
} else {
switch (error) {
case NADFullBoardLoaderErrorFailedAdRequest:
NSLog(@"The ad request failed.");
break;
case NADFullBoardLoaderErrorFailedDownloadImage:
NSLog(@"Failed to download ad images.");
break;
case NADFullBoardLoaderErrorInvalidAdSpaces:
NSLog(@"An inventory that is not available for fullBoard ads has been specified.");
break;
default:
break;
}
}
}];
}
@endNext, display the loaded ad in any way.
-
When modal display is performed on the full screen
Swift
class ViewController: UIViewController { private func showFullBoardAd() { if let ad = self.ad { // The `UIViewController` passed as the first argument must be properly placed on the` UIWindow` hierarchy ad.show(from: self) } } }
Objective-C
@implementation ViewController - (void)showFullBoardAd { [self.ad showFromViewController:self]; } @end
-
Displaying the advertisement screen in an arbitrary way
Swift
class ViewController: UIViewController { private func showCustomFullBoardAd() { if let ad = self.ad { // You can get `UIViewController` for ad display from the` NADFullBoard` object let adViewController = ad.fullBoardAdViewController() // The acquired 'UIViewController` can be displayed by the application in an arbitrary way // If you retrieve `view` of` UIViewController` and display it with `addSubView:` in any `UIView`, keep the instance on the application side so that the acquired` UIViewController` will not be released // e.g. push self.navigationController!.pushViewController(adViewController!, animated: true) // In addition, you can also display `close button` which SDK side prepared by the following method adViewController?.enableCloseButton(clickHandler: { // Implement processing when the close button is clicked }) } } }
Objective-C
@implementation ViewController - (void)showCustomFullBoardAd { UIViewController<NADFullBoardView> *adViewController = [self.ad fullBoardAdViewController]; [self.navigationController pushViewController:adViewController animated:YES]; [adViewController enableCloseButtonWithClickHandler:^{ ... }]; } @end
Note: When you close the fullscreen ads, the ad is not automatically reloaded. When updating the advertisement contents, you need to execute the loading process again.
You can get various advertisement events in one of the following ways.
-
When modal display is performed on the full screen
Swift
// Implement `NADFullBoardDelegate` class ViewController: UIViewController, NADFullBoardDelegate { private func loadFullBoardAd() { self.adLoader.loadAd { [weak self] (ad: NADFullBoard?, error: NADFullBoardLoaderError) in guard let `self` = self else { return } if let fullBoardAd = ad { fullBoardAd.delegate = self ... } } } // MARK: - NADFullBoardDelegate // Called when advertisement is displayed func nadFullBoardDidShowAd(_ ad: NADFullBoard!) { print(#function) } // Called when an ad is clicked func nadFullBoardDidClickAd(_ ad: NADFullBoard!) { print(#function) } // Called when closing ad func nadFullBoardDidDismissAd(_ ad: NADFullBoard!) { print(#function) } }
Objective-C
@interface ViewController () <NADFullBoardDelegate> ... @end @implementation ViewController - (void)loadFullBoardAd { __weak typeof(self) weakSelf = self; [self.loader loadAdWithCompletionHandler:^(NADFullBoard *ad, NADFullBoardLoaderError error) { if (ad) { ad.delegate = weakSelf; ... } }]; } #pragma mark - NADFullBoardDelegate - (void)NADFullBoardDidShowAd:(NADFullBoard *)ad { NSLog(@"%s", __FUNCTION__); } - (void)NADFullBoardDidClickAd:(NADFullBoard *)ad { NSLog(@"%s", __FUNCTION__); } - (void)NADFullBoardDidDismissAd:(NADFullBoard *)ad { NSLog(@"%s", __FUNCTION__); } @end
-
When displaying the advertisement screen in an arbitrary method
Swift
// Implement `NADFullBoardViewDelegate` class ViewController: UIViewController, NADFullBoardViewDelegate { private var ad: NADFullBoard? private func showCustomFullBoardAd() { if let ad = self.ad { let adViewController = ad.fullBoardAdViewController() adViewController?.delegate = self ... } } // MARK: - NADFullBoardViewDelegate // Called when an ad is clicked func nadFullBoardDidClickAd(_ ad: NADFullBoard!) { print(#function) } }
Objective-C
@interface ViewController () <NADFullBoardViewDelegate> @property (nonatomic, strong) NADFullBoard *ad; @end @implementation ViewController - (void)showCustomFullBoardAd { UIViewController<NADFullBoardView> *adViewController = [self.ad fullBoardAdViewController]; adViewController.delegate = self; ... } #pragma mark - NADFullBoardViewDelegate - (void)NADFullBoardDidClickAd:(NADFullBoard *)ad { NSLog(@"%s", __FUNCTION__); } @end
You can change the background color outside iPhoneX Safe Area more affinitive to your app looking & feeling.
- Sample with background color set to white

Swift
class ViewController: UIViewController {
private var adLoader: NADFullBoardLoader!
private var ad: NADFullBoard? // An instance of a fullBoard Ad
...
private func loadFullBoardAd() {
self.adLoader.loadAd { [weak self] (ad: NADFullBoard?, error: NADFullBoardLoaderError) in
guard let `self` = self else { return }
if let fullBoardAd = ad {
self.ad = fullBoardAd
self.ad!.backgroundColor = UIColor.white // Set white as background color
}
}
}
}Objective-C
@interface ViewController : UIViewController
@property (nonatomic, strong) NADFullBoardLoader *loader;
@property (nonatomic, strong) NADFullBoard *ad;
@end
...
@implementation ViewController
...
- (void)loadFullBoardAd
{
__weak typeof(self) weakSelf = self;
[self.loader loadAdWithCompletionHandler:^(NADFullBoard *ad, NADFullBoardLoaderError error) {
if (ad) {
weakSelf.ad = ad;
weakSelf.ad.backgroundColor = [UIColor whiteColor];
}
}];
}
@endBy default the background color is black.

-
v7.0.4 以降のバージョンから SKAdNetwork を使用した広告配信を行っております。最新版のSDKへのアップデートを推奨します。
更新履歴はこちらを参照ください。 -
iOS14以降では、広告の効果を測定するためにアプリに追加の設定を行う必要があります。
詳細はこちらを参照ください。 -
2023年9月1日より、SDK v6.0.0未満では動画広告の配信を停止いたします。新しいバージョンのご利用をご検討ください。
-
We recommend updating to latest version. v7.0.4 or higher it using advertise SKAdNetwork.
For details, please Release Notes. -
Need to configure the app for ad conversion tracking for iOS14.
For details, please check here. -
Effective September 1, 2023, we will stop serving video ads with SDK under v6.0.0. Please consider using a newer version.
- バナー型広告
- インタースティシャル広告
- ネイティブ広告
- フルボード広告
- 動画広告
- 動画ネイティブ広告
- Release Notes
- Preparation
- Supported Environments
- nendSDK Data Collection Items
- Privacy Policy
- About Information Button
- Add Manually
- Use CocoaPods
- Preparing for iOS14 or later
- When updating from nendSDK before version 3.2.2
- Banner Ad
- Interstitial Ad
- Native Ad
- Fullscreen Ad
- Video Ad
- Native Video Ad