스플래시 광고

모바일 앱의 스플래시 화면(Splash Screen) 내 광고를 송출하는 형태입니다.

스플래시 화면이 되는 ViewController 를 생성한 뒤 MainStory 보드에서 맨 처음 시작하는 ViewController로 세팅해 줍니다.

1. 인스턴스 생성

SplashViewController.m에 AdPopcornSSPSplashAd.h 를 import 하고 인스턴스 변수를 선언합니다.

#import <AdPopcornSSP/AdPopcornSSPSplashAd.h>

@interface SplashViewController() <APSSPSplashAdDelegate>
{ 
    AdPopcornSSPSplashAd *_sspSplashAd;
}
@end

SplashViewController.m 을 수정하여 생성한 인스턴스를 구현합니다.

@implementation SplashViewController 

- (void)viewDidLoad {
    [super viewDidLoad]; 

    _sspSplashAd = [[AdPopcornSSPSplashAd alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) Key:@"YOUR_APP_KEY" placementId:@"YOUR_PLACEMENT_ID" viewController:self];
    [self.view addSubView:_sspSplashAd];
}
@end

2. 광고 타입 설정

아래 코드를 추가하여 스플래시 광고의 타입을 설정 합니다.

[_sspSplashAd setFullScreenSplash:YES]; // 기본값 : 일반모드(NO)

지원 하는 형태의 광고는 총 2가지 이며, 아래 예시와 같이 노출됩니다.

광고 타입
설명
예시 이미지

일반 모드(:NO, false)

정사각형 형태의 광고가 노출됩니다. 이에 로고 하단에 노출시켜줍니다.

전체 화면 모드(:YES, true)

전체 화면을 채우는 형태의 광고가 노출됩니다.

3. 스플래시 광고 요청

loadRequest API를 호출하여 스플래시 광고를 요청합니다.

[_sspSplashAd loadRequest];

4. 델리게이트 설정

스플래시 광고에서 발생하는 이벤트에 대한 델리게이트를 제공합니다.

델리게이트를 사용하기 위해서는 APSSPSplashAdDelegate를 추가하여야 합니다.

_sspSplashAd 인스턴스에 delegate를 설정하고 구현하여야 합니다.

delegate
설명

APSSPSplashAdLoadSuccess

스플래시 광고 로드 성공

APSSPSplashAdLoadFail, error

APSSPSplashAdImpression

스플래시 광고 화면 노출

#import <AdPopcornSSP/AdPopcornSSPSplashAd.h>	

@interface SplashViewController () <APSSPSplashAdDelegate>	
{	

@end	

@implementation SplashViewController 

- (void)viewDidLoad { 
      [super viewDidLoad]; 
      
      _sspSplashAd = [[AdPopcornSSPSplashAd alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) Key:@"YOUR_APP_KEY" placementId:@"YOUR_PLACEMENT_ID" viewController:self];
      _sspSplashAd.delegate = self;
      [_sspSplashAd setFullScreenSplash:YES];
      [self.view addSubView:_sspSplashAd];
      
      [_sspSplashAd loadRequest];
}

#pragma APSSPSplashAdDelegate 
- (void)APSSPSplashAdLoadSuccess:(AdPopcornSSPSplashAd *)splashAd
{
      // 로드 성공, 원하는 시간 만큼 대기 후, 다음 ViewController를 호출한다.
      dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 3 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
      	      // 다음 ViewController 호출
      	      NextViewController *next = [[NextViewController alloc] init];
      	      [self presentViewController:next animated:YES completion:nil];
      });
}
- (void)APSSPSplashAdLoadFail:(AdPopcornSSPSplashAd *)splashAd error:(AdPopcornSSPError *)error;
{
      // 로드 실패, 바로 다음 ViewController를 호출한다
      NextViewController *next = [[NextViewController alloc] init];
      [self presentViewController:next animated:YES completion:nil];
}

- (void)APSSPSplashAdImpression:(AdPopcornSSPSplashAd *)splashAd
{
}
@end

Last updated

Was this helpful?