> 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-2.x.x/v1.5.md).

# 보상형 광고 플러스 연동(v1.5)

{% hint style="info" %}
보상형 광고 플러스는 iOS v2.10.2 이상의 버전부터 지원합니다.
{% endhint %}

## 1. 유저 식별값(USN) 입력

보상형 광고 플러스 기능을 활성화 및 활용하기 위해서는 반드시 유저의 식별값이 지정되어야 합니다.

유저 식별값은 리워드 지급 조건이 달성되었을 때 **완료 유저를 식별하기 위해 사용되는 고유한 값**입니다.

{% hint style="danger" %}
**주의 사항**

1. 1명의 유저는 반드시 1개의 고유한 유저 식별값(USN)을 가져야 하며, 앱 실행 시점이나 세션마다 변경되는 가변적인 값은 사용할 수 없습니다.
2. 개인정보(이메일, 이름, 전화번호, 식별 가능한 유저 아이디 등)이 포함되어서는 안됩니다.
3. USN으로 사용하기에 적합하지 않은 값의 예시는 다음과 같습니다.&#x20;
   1. 디바이스 ID(Android ID, Advertising ID, IDFA 등)&#x20;
   2. 앱 재설치, 기기 변경, 초기화 등에 따라 변경될 수 있는 값
4. 한글, 특수 문자, 공백 등이 포함된 경우에는 반드시 URL 인코딩 처리를 하여 사용하여야 합니다.
5. USN은 비디오 광고 로딩 이전에 반드시 설정되어 있어야 합니다.
6. <mark style="color:red;">**개발 서버에서 사용한 특정 USN값을 라이브 서버에서 유저가 할당받지 않도록 예외 처리를 하거나, 개발 서버에서 사용하는 USN은 별도 구분값을 설정해주셔야 합니다.**</mark>
   {% endhint %}

위 주의사항에 유의하여 유저 식별값을 입력합니다.

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

```objectivec
[AdPopcornSSP.setUserId:@"TEST_USN"];
```

{% endtab %}

{% tab title="Swift" %}

```swift
AdPopcornSSP.setUserId("TEST_USN")
```

{% endtab %}
{% endtabs %}

## 2. 보상형 광고 플러스 세팅 페이지 연동

유저의 CS 문의 및 현재 리워드 참여 횟수 확인을 위해서는 세팅 페이지 연동이 반드시 필요합니다.

유저의 보상형 광고 플러스 정보는 아래 API를 통해 확인 가능합니다.&#x20;

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

```objectivec
#import "AdPopcornSSPRewardAdPlus.h"

[AdPopcornSSPRewardAdPlus openRewardAdPlusViewController:@"your_app_key" viewCotroller:self];  
```

{% endtab %}

{% tab title="Swift" %}

```swift
AdPopcornSSPRewardAdPlus.openViewController("your_app_key", viewCotroller: self)
```

{% endtab %}
{% endtabs %}

* 현재 지원하는 버전은 아래와 같습니다.
  * AdPopcornSSPRewardAdPlus.getVersion = "1.5"

<figure><img src="/files/KlorLRXA4gmlPeOlvoUa" alt="" width="360"><figcaption><p>v1.5 보상형 광고 플러스 설정 페이지 예시</p></figcaption></figure>

## 3. 보상형 광고 플러스 이벤트 처리

보상형 광고 플러스에서 발생되는 아래 이벤트들에 대해선 이벤트 리스너로 이벤트를 전달해 줍니다.

* closedRewardAdPlusPage : 보상형 광고 세팅 페이지 닫기
* pointBoxEventResult : 1차 광고 완료 후 포인트 박스 지급 성공 or 실패에 대한 이벤트

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

```objectivec

APSSPRewardAdPlusEventDelegate 

// delegate 연결
[AdPopcornSSPRewardAdPlus sharedInstance].delegate = self;


-(void)eventResult:(int)resultCode resultMessage:(NSString *)message
{

}

- (void)closedRewardAdPlusPage
{

}

```

{% endtab %}

{% tab title="Swift" %}

```swift
class viewController: APSSPRewardAdPlusEventDelegate {

    AdPopcornSSPRewardAdPlus.sharedInstance().delegate = self
        ​
    func closedRewardAdPlusPage() {
            print("closedRewardAdPlusPage")
    }
        
    func eventResult(_ resultCode: Int32, resultMessage message: String!) {
            print("resultCode \(resultCode)")
    }
}
```

{% endtab %}
{% endtabs %}

## 4. 보상형 광고 플러스 사용자 정보 조회

현재 유저의 사용 정보를 직접 조회하고자 할 땐, 아래의 API를 활용 가능합니다.

{% tabs %}
{% tab title="Objective-C" %}
{% code overflow="wrap" %}

```objectivec
[AdPopcornSSPRewardAdPlus sharedInstance].delegate = self;
// 애드 플러스 지면에 대한 정보
[AdPopcornSSPRewardAdPlus getRewardAdPlusUserMediaStatus:@"your_app_key"];
// 특정 지면에 대한 정보
[AdPopcornSSPRewardAdPlus getRewardAdPlusUserPlacementStatus:@"your_app_key" placementId:@"your_placementId"];
```

{% endcode %}
{% endtab %}

{% tab title="Swift" %}
{% code overflow="wrap" %}

```swift
AdPopcornSSPRewardAdPlus.sharedInstance().delegate = self
// 애드 플러스 지면에 대한 정보
AdPopcornSSPRewardAdPlus.getUserMediaStatus("your_app_key")
// 특정 지면에 대한 정보
AdPopcornSSPRewardAdPlus.getUserPlacementStatus("your_app_key", placementId: "your_placementId")
```

{% endcode %}
{% endtab %}
{% endtabs %}

* getRewardAdPlusUserMediaStatus  : 매체에 활성화된 전체 리워드 애드 플러스 지면에 대한 정보
* OnRewardAdPlusUserPlacementStatus : 특정 지면에 대한 정보

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

```objectivec
// 애드 플러스 지면에 대한 정보 callback
-(void) rewardAdPlusUserMediaStatusWithResult:(BOOL)result totalBoxCount:(NSInteger)totalBoxCount placementStatusList:(NSArray *)placementStatusList {
    
}
// 특정 지면에 대한 정보 callback
-(void) rewardAdPlusUserPlacementStatusWithResult:(BOOL)result placementId:(NSString *)placementId dailyUserLimit:(NSInteger)dailyUserLimit dailyUserCount:(NSInteger)dailyUserCount {

}	
```

{% endtab %}

{% tab title="Swift" %}

```swift
// 애드 플러스 지면에 대한 정보 callback
func rewardAdPlusUserMediaStatus(withResult result: Bool, totalBoxCount: Int, placementStatusList: [Any]!) {
    var array : [SummaryCurrentPlacementModel] = []
    for placement in placementStatusList {
        guard let placements = placement as? SummaryCurrentPlacementModel else {
            return }
        let currnet = placements.current
        let limit = placements.limit
        let placementId = placements.placementId
        
        print("aaa", currnet, limit, placementId)
    }
}
// 특정 지면에 대한 정보 callback
func rewardAdPlusUserPlacementStatus(withResult result: Bool, placementId: String!, dailyUserLimit: Int, dailyUserCount: Int) {
    print("bbb = \(result), \(placementId),\(dailyUserLimit), \(dailyUserCount)")
}
```

{% endtab %}
{% endtabs %}

위 API를 호출할 경우, rewardAdPlusUserPlacementStatus 를 통해, 아래의 정보가 내려옵니다.

* result : 조회 성공 여부
* placementId : 조회 한 지면 키
* totalBoxCount : 전체 받은 포인트 박스
* dailyUserLimit : 일별 유저 한도
* dailyUserCount : 일별 유저 참여 횟수


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://adpopcornssp.gitbook.io/ssp-sdk/sdk/ios/ios-2.x.x/v1.5.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
