로딩중입니다
라이브오퍼레이션 연동 : iOS
12/13/2017 2:16:15 PM

라이브오퍼레이션 서비스

라이브오퍼레이션 서비스는 앱 사용자를 필터링하여 타겟팅 된 푸시를 발송할 수 있는 타겟푸시 기능과 사용자에게 알려야할 내용이 있을 때 팝업 형태의 공지창을 이용하여 안내 내용을 노출하는 공지팝업 기능을 제공하는 서비스입니다.

푸시 연동을 통해 앱 운영자는 고도화된 푸시 시스템을 이용하여 운영을 할 수 있으며, 공지팝업 기능을 통해 진행 중인 이벤트나 신규 기능 출시 등의 안내를 진행할 수 있습니다.

라이브오퍼레이션 서비스 소개나 이용방법 안내는 아래의 아티클을 통해 확인할 수 있습니다.

[라이브오퍼레이션 서비스 소개]


서비스 이용 중 도움이 필요한 경우에는 아래 메일 주소로 연락 부탁 드립니다.

기술문의 - 기술지원팀 (tech_support@igaworks.com)




SDK 설치


라이브오퍼레이션 서비스는 cocoapods 를 이용한 자동설치를 지원합니다.


최소요구사항

IGAWorks iOS sdk 최소 요구사항은 다음과 같습니다.

  • Xcode 7.0 이상
  • iOS SDK 9.0 이상
  • Deployment Target 6.0 이상


CocoaPods 설치

다음의 명령어를 실행하여 CocoaPods를 설치합니다. (이미 설치된 경우는 이 단계를 건너뜁니다.)

$ sudo gem install cocoapods


다음과 같은 화면이 나타나면 설치가 완료된 것입니다.


CocoaPods 초기화

다음의 명령어를 실행하여 CocoaPods 를 초기화합니다.

$ pod setup


다음과 같은 화면이 나타나면 초기화가 완료된 것입니다.



Podfile 생성

CocoaPods 를 적용할 Xcode 프로젝트가 위치한 폴더에서 다음의 명령어를 실행하여 Podfile을 생성합니다.

$ cd /path/to/MyXcodeProject
$ touch Podfile



Podfile 편집

생성된 Podfile 을 vi 에디터를 이용하여 라이브오퍼레이션 이용에 필요한 내용을 작성합니다.

platform :ios, '8.0'
target "myProjectName" do
pod 'IgaworksCore'
pod
end

platform 의 값 중, '8.0' 의 값은 Xcode 프로젝트에서 지원하는 최소 iOS OS 버전을 의미합니다.

 일반 텍스트 에디터에서는 인코딩 문제로 오류가 발생할 수도 있습니다.



Pod Install (프레임워크 설치)

다음의 명령어를 실행하여 라이브오퍼레이션 필수 프레임워크를 설치합니다.

$ pod install


다음의 명령어를 실행하여 Xcode 프로젝트를 오픈하면 프레임워크가 설치된 것을 확인할 수 있습니다.

$ open MyXcodeProject.xcworkspace


Pod Update (프레임워크 업데이트)

다음의 명령어를 실행하여 향후 최신의 라이브오퍼레이션 프레임워크로 업데이트를 할 수 있습니다.

$ pod update




기본 연동

다음 필수 api를 AppDelegate의 didFinishLaunchingWithOptions 에 추가합니다.



IDFA 등록

애플 광고 식별자를 SDK에 전달합니다.

#import "AppDelegate.h"
#import <AdSupport/AdSupport.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
if (NSClassFromString(@"ASIdentifierManager")){
NSUUID *ifa =[[ASIdentifierManager sharedManager]advertisingIdentifier];
BOOL isAppleAdvertisingTrackingEnalbed = [[ASIdentifierManager sharedManager]isAdvertisingTrackingEnabled];
[IgaworksCore setAppleAdvertisingIdentifier:[ifa UUIDString] isAppleAdvertisingTrackingEnabled:isAppleAdvertisingTrackingEnalbed];

NSLog(@"[ifa UUIDString] %@", [ifa UUIDString]);
}

[IgaworksCore igaworksCoreWithAppKey:@"YOUR_APP_KEY" andHashKey:@"YOUR_HASH_KEY"];

return YES;
}

애플 광고 식별자를 얻기 위해서는 AdSupport 헤더를 추가하여야 합니다.



앱키 & 해시키 추가

라이브오퍼레이션 어드민에서 앱 등록 후 발급받은 앱키, 해시키를 설정합니다.

#import "AppDelegate.h"
#import <AdSupport/AdSupport.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
if (NSClassFromString(@"ASIdentifierManager")){
NSUUID *ifa =[[ASIdentifierManager sharedManager]advertisingIdentifier];
BOOL isAppleAdvertisingTrackingEnalbed = [[ASIdentifierManager sharedManager]isAdvertisingTrackingEnabled];
[IgaworksCore setAppleAdvertisingIdentifier:[ifa UUIDString] isAppleAdvertisingTrackingEnabled:isAppleAdvertisingTrackingEnalbed];

NSLog(@"[ifa UUIDString] %@", [ifa UUIDString]);
}

[IgaworksCore igaworksCoreWithAppKey:@"YOUR_APP_KEY" andHashKey:@"YOUR_HASH_KEY"];

return YES;
}

 위 api는 반드시 IDFA 설정이 된 다음에 호출되어야 합니다.



로그 레벨 설정

SDK에서 출력하는 로그의 수준을 설정할 수 있습니다.

  • IgaworksCoreLogInfo  : info 수준의 가장 기본적인 로그 만을 노출합니다.
  • IgaworksCoreLogDebug  : info를 포함한 Debug 수준의 로그를 노출합니다.
  • IgaworksCoreLogTrace  : 모든 로그를 노출합니다.
[IgaworksCore setLogLevel:IgaworksCoreLogTrace];

 정의된 로그 레벨 enum 은 IgaworksCore.h 에 포함되어져 있습니다.




푸시연동 : 서버푸시

APNS 인증서 등록

애플 개발자 센터에서 생성한 APNS 푸시 인증서를 라이브오퍼레이션 어드민에 등록합니다.

 .p12 확장자를 가진 인증서를 등록해야 합니다.

 빌드 환경에 따라 인증서를 구분하여 등록해야 합니다. 테스트 용 빌드에서는 Development, 출시 용 빌드에서는 Production 를 사용합니다.



SDK Target 이 7.0 인 경우

개발 환경의 iOS SDK TARGET 이 7.0 이상인 경우에 info.plist 에 다음과 같이 노드를 추가합니다.



Xcode 설정

푸시 서비스 활성화를 위해 Project -> Capablities 에 아래 기능을 활성화 합니다.

Push Service 활성화



Background mode 활성화



NotificationDelegate 파일 추가

원할한 푸시 수신을 위해 NotificationDelegate 파일을 생성하여 프로젝트에 추가합니다.


NotificationDelegate.h
#ifndef NotificationDelegate_h
#define NotificationDelegate_h

@import UserNotifications;
  #import <LiveOps/LiveOpsPush.h>


@interface NotificationDelegate : NSObject <UNUserNotificationCenterDelegate>

@end
  #endif /* NotificationDelegate_h */

NotificationDelegate.m
#import <foundation/foundation.h>
#import "NotificationDelegate.h"
#import <LiveOps/LiveOps.h>


@implementation NotificationDelegate

- (void)userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
         withCompletionHandler:(void(^)(void))completionHandler {
    
    [LiveOpsPush handleUserNotificationCenter:center
               didReceiveNotificationResponse:response];
    completionHandler();
}

- (void)userNotificationCenter:(UNUserNotificationCenter *)center
       willPresentNotification:(UNNotification *)notification
         withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
    
    NSDictionary* userInfo = [notification.request.content.userInfo mutableCopy];
    [LiveOpsPush handleUserNotificationCenter:center
                      willPresentNotification:notification
                willShowSystemForegroundAlert:YES];
    
    
    completionHandler(UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionSound);
}

@end

AppDelegate.h 파일 수정

푸시 수신을 위해 AppDelegate.h 파일을 수정합니다.

AppDelegate.h
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 100000
#define XC8_AVAILABLE 1
#import <UserNotifications/UserNotifications.h>
#import "NotificationDelegate.h"
#endif

@interface AppDelegate : UIResponder <UIApplicationDelegate>{

#if XC8_AVAILABLE
NotificationDelegate *notificationDelegate;
#endif
}

@property (strong, nonatomic) UIWindow *window;


@end

유저식별값 입력

유저식별값은 라이브오퍼레이션에서 유저를 판단하기 위해 사용되는 정보입니다.


주의 사항
  • 1명의 유저는 1개의 고유한 유저식별값을 가져야하며, 가변적인 값을 사용해서는 안됩니다.
  • 개인정보(이메일, 이름, 전화번호, 식별가능한 유저아이디 등)이 포함되어서는 안됩니다.
  • 한글, 특수문자, 공백 등이 포함된 경우에는 반드시 URL 인코딩 처리를 하여 사용하여야 합니다.
  • IgawLiveOps.initialize API가 호출되기 전에 설정되어야 합니다.

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

[IgaworksCore setUserId:@"bXlBY2NvdW50X25hbWU="];



SDK 초기화

라이브오퍼레이션을 이용하기 위해 아래 api를 이용하여 SDK 초기화를 진행합니다.

이 연동이 완료되면 서버 푸시의 이용이 가능하며, 푸시 오픈에 대한 트래킹이 가능합니다.

(void)setUserId:(NSString *)userId

(void)initPush

(void)handleAllNotificationFromLaunch:(NSDictionary*)launchOptions

(void)setDeviceToken:(NSData*)deviceToken

#import <IgaworksCore/IgaworksCore.h>
#import <LiveOps/LiveOps.h>
 
@implementation AppDelegate
 
-(BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
    //NotificationDelegate 설정
    if ([UNUserNotificationCenter class]) {
        notificationDelegate = [NotificationDelegate new];
        [[UNUserNotificationCenter currentNotificationCenter] setDelegate:notificationDelegate];
    } 
  
  //IGAWorks 공통연동 API
    [IgaworksCore igaworksCoreWithAppKey:@"앱키를 설정하세요" andHashKey:@"해시키를 설정하세요" andIsUseIgaworksRewardServer:NO];
 
    //LiveOpsPush 를 사용하기 위해서 반드시 user id를 설정하여야 합니다.
    [IgaworksCore setUserId:@"bXlBY2NvdW50X25hbWU="];
 
    //LiveOpsPush를 초기화합니다.
    [LiveOpsPush initPush];
 
    //LiveOps Push Notification Handler를 등록합니다.
    [LiveOpsPush handleAllNotificationFromLaunch:launchOptions]; 
    
    return YES;
}
 
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
    //디바이스 토큰을 등록합니다.
    [LiveOpsPush setDeviceToken:deviceToken];
}
 
- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
    //디바이스 토큰 등록 실패 로그 확인
    NSLog(@"Device Token Register Failed: %@", error);
}



서버 푸시 델리게이트

서버 푸시를 수신하고 관리하기 위한 델리게이트를 등록합니다.

#if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_7_0
#warning "Remote push open tracking is counted only when user touches notification center under iOS SDK 7.0"

// iOS version7 미만일 때,
- (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
[LiveOpsPush handleRemoteNotification:userInfo fetchHandler:nil];
}
#else
// iOS version7 이상일 때,
- (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
[LiveOpsPush handleRemoteNotification:userInfo fetchHandler:completionHandler];
}
#endif

//Local Push Handler
- (void)application:(UIApplication*)application didReceiveLocalNotification:(UILocalNotification *)notification
{
[LiveOpsPush handleLocalNotification:notification];
}

 위 샘플과 같이 iOS7을 기준으로 하여 OS 버전에 따라 델리게이트 등록을 해야 합니다.



딥링크 연동 / 서버푸시

라이브오퍼레이션 서버푸시에서는 딥링크 기능을 제공합니다.

딥링크 기능은 유저가 푸시를 수신하고 오픈했을 때, 딥링크 데이터에 정의된 액션을 수행하는 것을 가능하게 합니다.

딥링크 데이터는 라이브오퍼레이션 어드민에서 생성 및 관리하며 3가지 타입으로 등록할 수 있습니다.

종류
형식
URL (Http 타입)
http://www.igaworks.com
URL (Custom Scheme 타입)
scheme://host?key=value
Json 타입
{"key":"value","igaworks":"sample"}


Info.plist 수정

딥링크 기능을 이용하기 위해서 info.plist에 다음과 같이 노드를 추가해야 합니다.



딥링크 데이터 확인

딥링크로 전달된 데이터를 확인하는 방식은 라이브오퍼레이션 델리게이트를 이용하는 방식과 AppDelegate를 이용하는 방식이 있습니다.

단, Json 타입의 딥링크를 사용하시는 경우에는 라이브오퍼레이션 델리게이트를 사용하여야만 합니다.

  • 라이브오퍼레이션 델리게이트 이용
  • AppDelegate 이용


라이브오퍼레이션 델리게이트 이용

델리게이트를 이용하기 위해서는 반드시 handleAllNotificationFromLaunch: API보다 먼저 델리게이트를 등록해야 합니다.

델리게이트의 pushInfos 에서 딥링크 정보를 확인할 수 있으며 그 상세한 내용은 아래와 같습니다.

  • pushInfos.sentTime : 발신된 시각
  • pushInfos.bodyText : 푸시 내용
  • pushInfos.deepLinkUrl : Apple Scheme Url 타입의 딥링크, 기본값 nil
  • pushInfos.deepLink : Json 타입의 딥링크, 기본값 nil
-(BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
// 딥링크를 위한 델리게이트 등록
[LiveOpsPush setRemoteNotificationListener:^(NSArray* pushInfos, BOOL isForeGround) {
for(LiveOpsPushInfo *pushInfo in pushInfos){
/* pushInfos 객체 */
// pushInfo.sentTime : 발신된 시각
// pushInfo.bodyText : 푸시 내용
// pushInfo.deepLinkUrl : 딥링크 URL, 기본값-nil
// pushInfo.deepLink : 딥링크 JsonObject, 기본값-nil

/* isForeGround */
// YES : app이 활성화된 상태에서 푸시를 수신
// NO : app이 비활성화된 상태에서 푸시를 수신
}
}];

//LiveOps Push Notification 델리게이트를 등록합니다.
[LiveOpsPush handleAllNotificationFromLaunch:launchOptions];

return YES;
}



AppDelegate 이용

Custom Scheme 타입의 딥링크를 사용하는 경우에는 AppDelegate를 이용하여 딥링크 정보를 확인할 수 있습니다.
application: openUrl: sourceApplication: annotation: 델리게이트의 url 파라미터로 전달되는 정보를 이용하여 확인합니다.

#import "AppDelegate.h"
#import <IgaworksCore/IgaworksCore.h>
#import <LiveOps/LiveOps.h>

@implementation AppDelegate

-(BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(idD)annotation
{
//이 곳으로 푸시 딥링크가 전달됩니다.
//확인한 딥링크 정보를 이용하여 원하는 액션을 실행합니다.
NSLog(@"LiveOps Deep Link Url Info : %@", [url absoluteString]);

//ex. 딥링크가 liveOps://com.igaworks.test?view=myview&param=1 로 받은 경우
NSString* query = [url query];
NSArray *queryPairs = [query componentsSeparatedByString:@"&"];
NSMutableDictionary *pairs = [NSMutableDictionary dictionary];
for(NSString* queryPair in queryPairs)
{
NSArray *bits = [queryPairs componentsSeparatedByString:@"="];
NSString *key = [bits objectAtIndex:0];
NSString *value = [bits objectAtIndex:1];
[pairs setObject:value forKey:key];

NSLog(@"LiveOps Deep Link Action~!! key: %@ , value: %@" , key, value);
}
return YES;
}

 AppDelegate 방식에서는 Json 타입의 딥링크는 사용할 수 없습니다.




푸시 연동 : 클라이언트 푸시

라이브옵스는 클라이언트에서 API를 이용하여 직접 생성하여 사용할 수 있는 클라이언트 푸시 기능을 제공합니다.

일반적으로 클라이언트 푸시는 앱 내에서 미리 지정한 조건에 유저가 일치하였을 때, 푸시를 생성하여 노출합니다.

또한 개발사 서버와 앱 간의 통신이 가능하다면, 서버 이벤트를 캐치하여 푸시를 생성하는 방식으로도 사용할 수 있습니다.

클라이언트 푸시에서는 일반 푸시와 빅 텍스트 푸시를 지원합니다.


푸시 생성 및 노출

다음 api를 이용하여 로컬 푸시를 만들어 노출합니다.

[LiveOpsPush registerLocalPushNotification:localPid  //유니크한 식별자
date:dateObj //노출 예정 시각
body:@"hello" //local push에 노출될 문구
button:@"go": //local push 확인버튼 혹은 잠금해제 버튼 텍스트
soundName:nil //실행할 사운드 파일 이름, nil : iOS 기본사운드재생
badgeNumber:0 //미확인 시 앱 아이콘에 표시될 미확인 메시지 알림 수치
customPayload:nil //customPayload를 통해 등록한 유저 정보
];



푸시 취소

다음 api를 이용하여 노출되지 않은 예약된 로컬 푸시를 취소할 수 있습니다.

//localPid : local push를 등록했을 때 입력한 푸시 id
[LiveOpsPush cancelLocalPush:localPid];



로컬 푸시 델리게이트

로컬 푸시에 대한 이벤트를 델리게이트로 확인할 수 있습니다.

-(BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
[LiveOpsPush setLocalNotificationListener:^(NSInteger Id, NSDate* sentTime, NSString* bodyText, NSDictionary* customData, BOOL isForeGround) {
// Id : localPid : local push를 등록했을 때 입력한 푸시 id
// sentTime : 발신된 시각
// bodyText : 푸시 내용
// customData : customPayload를 통해 등록한 data


/* isForeGround */
// YES : app이 활성화된 상태에서 푸시를 수신
// NO : app이 비활성화된 상태에서 푸시를 수신
}];

//LiveOps Push Notification Handler를 등록합니다.
[LiveOpsPush handleAllNotificationFromLaunch:launchOptions];

return YES;
}

 반드시 handleAllNotificationFromLaunch: API보다 먼저 델리게이트를 등록해야 합니다.




푸시 추가 옵션


유저 타겟팅

유저그룹을 설정하여 타겟푸시의 수신 대상을 직접 선택할 수 있습니다.

유저그룹을 설정하기 위한 데이터는 직접 세팅하여 확보할 수 있습니다.


타겟팅 데이터 설정

타겟팅 된 유저에게만 서버푸시를 전송하기 위해서 커스텀 유저 데이터를 설정할 수 있습니다.

세팅된 커스텀 유저 데이터는 서버 푸시 어드민에서 확인할 수 있습니다. 아래 예시는 구매횟수를 커스텀 데이터로 수집하는 것입니다.

//[LiveOpsUser setTargetingData:(NSString*)customUserData withKey:(NSString*)customUserDataKey]
[LiveOpsPush setTargetingData:[MyUserData getPurchaseCount:@"user_info"] withKey:@"purchaseCount"];

 customUserData : 타겟팅을 위한 유저 데이터를 입력합니다.

 customUserDataKey : 유저 커스텀 데이터 키를 설정합니다.



타겟팅 데이터 불러오기

설정한 타겟팅 데이터를 불러와 원하는 액션을 수행할 수 있습니다.

NSString* purchaseCount = [LiveOpsPush getTargetingDataWithKey:@"purchaseCount"];



타겟팅 데이터 수동 동기화

다음 api를 이용하여 설정한 타겟팅 데이터를 라이브오퍼레이션 서버와 수동으로 동기화할 수 있습니다.

[LiveOpsUser flush];



푸시 수신 on/off

전송되는 서버 푸시에 대해서 수신 여부를 설정할 수 있습니다. 일반적으로 유저가 푸시 수신 여부를 설정할 때, api를 호출합니다.

함께 제공하는 델리게이트를 이용하여 설정된 푸시 수신 처리 결과를 확인하고 추가 액션을 할 수 있습니다.


푸시 수신 설정
  • YESY : 푸시를 수신함
  • false : 푸시를 수신하지 않음.

[LiveOpsPush setRemotePushEnable:YES];


푸시 수신 설정 결과 델리게이트

설정한 푸시수신여부에 대한 라이브오퍼레이션 서버의 응답을 확인할 수 있습니다.

[LiveOpsPush setRemotePushEnable:NO completion:^(BOOL result) {
//result값이 true가 아니면 서버에 제대로 반영되지 않은 것
//(네트워크 문제 혹은 디바이스토큰 등록이 안된 경우)
if (result) {
//수신된 정보를 이용하여 원하는 액션을 실행합니다.
}
}];




공지팝업 연동


공지팝업 서비스를 이용하기 위해서 다음의 단계에 따라서 초기화를 진행합니다.

앱 실행 후 최대한 빠른 시점에 아래의 초기화 api들을 호출하는 것을 권장합니다.


유저식별값 입력

유저식별값은 라이브오퍼레이션에서 유저를 판단하기 위해 사용되는 정보입니다.


주의사항
  • 1명의 유저는 1개의 고유한 유저식별값을 가져야하며, 가변적인 값을 사용해서는 안됩니다.
  • 개인정보(이메일, 이름, 전화번호, 식별가능한 유저아이디 등) 가 포함되어서는 안됩니다.
  • 한글, 특수문자, 공백 등이 포함된 경우에는 반드시 URL 인코딩 처리를 하여 사용하여야 합니다.
  • requestPopupResources api가 호출되기 전에 설정되어야 합니다.


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

[IgaworksCore setUserid:@"bXlBY2NvdW50X25hbWU="];



공지팝업 데이터로드 및 노출

requestPopupResources api 를 호출하여 라이브오퍼레이션 어드민에서 설정한 공지팝업 데이터를 불러오고 공지팝업을 노출합니다.

#import "ViewController.h"
#import "AppDelegate.h"
#import <igaworkscore igaworkscore.h>
#import <liveops liveops.h>

//공지팝업 데이터로드
[LiveOpsPopup getPopups:^{
//공지팝업 데이터가 있을 경우 이 코드블럭이 호출됩니다.
NSLog(@"Popup Resource Loading Success");
//공지팝업 데이터가 로드 되면 공지팝업을 호출합니다.
[LiveOpsPopup showPopups:@"공지팝업스페이스키"]
}];

 유저식별값이 설정되지 않으면 공지팝업 데이터로드가 불가능합니다.

 공지팝업스페이스키는 라이브오퍼레이션 어드민에서만 발급 받을 수 있습니다.



공지팝업 딥링크 + 델리게이트

공지팝업의 딥링크 기능을 이용하여 공지팝업을 통한 다양한 액션을 수행하도록 처리할 수 있습니다.

제공되는 공지팝업 오픈/종료 델리게이트를 활용하여 적절하게 구현합니다.

// 오픈 리스너
[LiveOpsPopup setPopupLinkListener:^(NSString *popupSpaceKey, NSDictionary *customData) {
//팝업에 등록한 딥링크 데이터는 customData를 통해 전달됩니다.
//JSON딥링크 형태의 팝업이 아니면 custonData는 nil로 전달됩니다.

NSLog(@"popupLink listener called\n\
deep link json: %@", customData);
}];


// 닫기 리스너
[LiveOpsPopup setPopupCloseListener:^(NSString *popupSpaceKey, NSString *popupCampaignName, NSDictionary *customData, NSUInteger remainPopupNum) {
//팝업에 등록한 딥링크 데이터는 customData를 통해 전달됩니다.
//JSON딥링크 형태의 팝업이 아니면 custonData는 nil로 전달됩니다.

NSLog(@"popupClose listener called\n\
popupCampaignName: %@\n\
deep link json: %@\n\
remainPopupNum: %lu", popupCampaignName, customData, (unsigned long)remainPopupNum);
}];

 딥링크 정보는 라이브오퍼레이션 어드민에서만 등록 및 설정할 수 있습니다.

 딥링크 데이터의 형태는 json 타입만 지원합니다.



공지팝업 유저 타겟팅

유저그룹을 설정하여 공지팝업의 노출대상을 직접 선택하실 수 있습니다.

유저그룹을 설정하기 위한 데이터는 직접 세팅하여 확보할 수 있습니다.


타겟팅 데이터 설정

타겟팅 된 유저에게만 서버푸시를 전송하기 위해서 커스텀 유저 데이터를 설정할 수 있습니다.

세팅된 커스텀 유저 데이터는 서버 푸시 어드민에서 확인할 수 있습니다. 아래 예시는 구매횟수를 커스텀 데이터로 수집하는 것입니다.

//[LiveOpsUser setTargetingData:(NSString*)customUserData withKey:(NSString*)customUserDataKey]
[LiveOpsPush setTargetingData:[MyUserData getPurchaseCount:@"user_info"] withKey:@"purchaseCount"];

 customUserData : 타겟팅을 위한 유저 데이터를 입력합니다.

 customUserDataKey : 유저 커스텀 데이터 키를 설정합니다.



타겟팅 데이터 불러오기

설정한 타겟팅 데이터를 불러와 원하는 액션을 수행할 수 있습니다.

NSString* purchaseCount = [LiveOpsPush getTargetingDataWithKey:@"purchaseCount"];



타겟팅 데이터 수동 동기화

다음 api를 이용하여 설정한 타겟팅 데이터를 라이브오퍼레이션 서버와 수동으로 동기화할 수 있습니다.

[LiveOpsUser flush];




공지팝업 추가 옵션


공지팝업 강제 종료

다음의 api를 이용하여 유저의 액션이 없이도 공지팝업을 종료하거나 취소할 수 있습니다.

// 현재 노출된 팝업만 종료
[LiveOpsPopup destroyPopup];

// 현재 노출된 팝업을 포함하여 이 후의 모든 팝업을 종료
[LiveOpsPopup destroyAllPopups];