> For the complete documentation index, see [llms.txt](https://adpopcornssp.gitbook.io/ssp-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://adpopcornssp.gitbook.io/ssp-sdk/sdk/ios/ios-3.1.0+/undefined-4.md).

# 전면광고

<div><figure><img src="/files/MbZv6n88WJpggqEJ2h2B" alt=""><figcaption></figcaption></figure> <figure><img src="/files/yIdDUbAHdCRDHHSytymX" alt=""><figcaption></figcaption></figure></div>

## 인스턴스 생성

{% tabs %}
{% tab title="Swift" %}

```swift
import APSSPSDK

var interstitialAd: APSSPInterstitialAd!

interstitialAd = APSSPInterstitialAd(
    appKey: "YOUR_APP_KEY",
    placementId: "YOUR_PLACEMENT_ID",
    rootViewController: self
)
interstitialAd.delegate = self
```

{% endtab %}

{% tab title="Objective-C" %}

```objc
@import APSSPSDK;

APSSPInterstitialAd *interstitialAd = [[APSSPInterstitialAd alloc] initWithAppKey:@"YOUR_APP_KEY"
                                                                       placementId:@"YOUR_PLACEMENT_ID"
                                                                rootViewController:self];
interstitialAd.delegate = self;
```

{% endtab %}
{% endtabs %}

## 전면 광고 Placement ID 설정

{% tabs %}
{% tab title="Swift" %}

```swift
interstitialAd.placementId = "전면광고_PLACEMENT_ID"
```

{% endtab %}

{% tab title="Objective-C" %}

```objc
interstitialAd.placementId = @"전면광고_PLACEMENT_ID";
```

{% endtab %}
{% endtabs %}

## 전면 광고 배경색 설정

{% tabs %}
{% tab title="Swift" %}

```swift
interstitialAd.backgroundColor = .blue
```

{% endtab %}

{% tab title="Objective-C" %}

```objc
interstitialAd.backgroundColor = [UIColor blueColor];
```

{% endtab %}
{% endtabs %}

## 전면 광고 요청

{% tabs %}
{% tab title="Swift" %}

```swift
interstitialAd.load()
```

{% endtab %}

{% tab title="Objective-C" %}

```objc
[interstitialAd load];
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
loadAd 호출에 대한 결과로 광고 수신에 실패한 경우에는 loadAd 재호출을 하시면 안됩니다. \
**과도한 광고 요청 API 호출은 block 사유**가 됩니다.
{% endhint %}

## 전면 광고 노출

로드 성공 콜백을 받은 후 원하는 시점에 호출합니다.

{% tabs %}
{% tab title="Swift" %}

```swift
interstitialAd.present(from: self)
```

{% endtab %}

{% tab title="Objective-C" %}

```objc
[interstitialAd presentFrom:self];
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
`present(from:)`은 Bool을 반환합니다.&#x20;

이미 노출 중이거나 준비되지 않은 경우 **false**를 반환합니다.
{% endhint %}

## 이벤트 리스너

<table><thead><tr><th width="374">이벤트 리스너</th><th>설명</th></tr></thead><tbody><tr><td><code>apsspInterstitialAdLoadSuccess</code></td><td>전면 광고 로딩 성공</td></tr><tr><td><code>apsspInterstitialAdLoadFail</code></td><td>전면 광고 로딩 실패</td></tr><tr><td><code>apsspInterstitialAdShowSuccess</code></td><td>전면 광고 노출 성공</td></tr><tr><td><code>apsspInterstitialAdShowFail</code></td><td>전면 광고 노출 실패</td></tr><tr><td><code>apsspInterstitialAdClicked</code></td><td>전면 광고 클릭</td></tr><tr><td><code>apsspInterstitialAdClosed</code></td><td>전면 광고 닫기</td></tr></tbody></table>

{% tabs %}
{% tab title="Swift" %}

```swift
extension ViewController: APSSPInterstitialAdDelegate {

    func apsspInterstitialAdLoadSuccess(interstitialAd: APSSPInterstitialAd) {
        interstitialAd.present(from: self)
    }

    func apsspInterstitialAdLoadFail(interstitialAd: APSSPInterstitialAd, error: APSSPNetworkError) {
    }

    func apsspInterstitialAdShowSuccess(interstitialAd: APSSPInterstitialAd) {
    }

    func apsspInterstitialAdShowFail(interstitialAd: APSSPInterstitialAd, error: APSSPNetworkError) {
    }

    func apsspInterstitialAdClicked(interstitialAd: APSSPInterstitialAd) {
    }

    func apsspInterstitialAdClosed(interstitialAd: APSSPInterstitialAd) {
    }
}
```

{% endtab %}

{% tab title="Objective-C" %}

```objc
- (void)apsspInterstitialAdLoadSuccessWithInterstitialAd:(APSSPInterstitialAd *)interstitialAd {
    [interstitialAd presentFrom:self];
}

- (void)apsspInterstitialAdLoadFailWithInterstitialAd:(APSSPInterstitialAd *)interstitialAd error:(enum APSSPNetworkError)error {
}

- (void)apsspInterstitialAdShowSuccessWithInterstitialAd:(APSSPInterstitialAd *)interstitialAd {
}

- (void)apsspInterstitialAdShowFailWithInterstitialAd:(APSSPInterstitialAd *)interstitialAd error:(enum APSSPNetworkError)error {
}

- (void)apsspInterstitialAdClickedWithInterstitialAd:(APSSPInterstitialAd *)interstitialAd {
}

- (void)apsspInterstitialAdClosedWithInterstitialAd:(APSSPInterstitialAd *)interstitialAd {
}
```

{% endtab %}
{% endtabs %}
