iOS 메시지 푸시 연동 문서
리소스 다운로드:
정식 버전: v1.1.2 Framework 다운로드
GitHub: ThinkingDataPushExtension
정식 버전: v1.1.2 Framework 다운로드
GitHub: ThinkingDataAnalyticsExtension
정식 버전: v3.1.6 Framework 다운로드
모든 이벤트 전송은 ThinkingSDK의 전송 기능에 의존하므로, 프로젝트에 먼저 ThinkingSDK를 통합해야 합니다.
절차는 ThinkingSDK 사용 문서인 iOS를 참고하십시오
개요
ThinkingSDK v3.0.1 이후 버전에서는 푸시 클릭 이벤트를 전송할 수 있습니다.
ThinkingDataPushExtension SDK(iOS 10 이상에서 사용 가능)로 푸시 도달 이벤트를 전송합니다.
메인 Target에 통합해야 하는 SDK
- cocoapods로 가져오는 것을 권장합니다
- ThinkingSDK는 데이터 수집 기능과 푸시 클릭 이벤트 전송에 사용됩니다
알림 확장 Target에 통합해야 하는 SDK
- cocoapods로 가져오는 것을 권장합니다
- ThinkingDataPushExtension은 알림 도달 이벤트를 자동으로 전송하는 데 사용됩니다
위 SDK는 모두 ThinkingDataCore 라이브러리에 의존하며, cocoapods로 통합하면 자동으로 가져옵니다. Framework 방식을 사용하는 경우 ThinkingDataCore의 Framework 라이브러리를 수동으로 가져와야 합니다.
cocoapods를 사용하면 ThinkingDataPushExtension이 ThinkingDataAnalyticsExtension 라이브러리를 자동으로 가져와 경량 데이터 수집 기능을 구현합니다. Framework 방식을 사용하는 경우 ThinkingDataAnalyticsExtension의 Framework 라이브러리를 수동으로 가져와야 합니다.
연동 절차
- app 메인 target에 수집 SDK(버전 >= 3.1.0)를 연동합니다
pod 'ThinkingSDK', '3.1.6'
- NotificationService 활성화
프로젝트에 알림 확장 Target을 새로 생성해야 합니다(예: TANotification)
- 알림 확장에 ThinkingDataPushExtension 통합
pod 'ThinkingDataPushExtension'
푸시 클릭 자동 회수 방식
자동 회수 활성화
NSString *appId = @"appId";
NSString *serverUrl = @"serverUrl";
TDConfig *config = [[TDConfig alloc] initWithAppId:appId serverUrl:serverUrl];
// 푸시 자동 회수 활성화
config.enableAutoPush = YES;
[TDAnalytics startAnalyticsWithConfig:config];
FCM 푸시
"푸시 ID" 전송
- FCM 푸시 SDK를 통합하면 ThinkingSDK가 자동으로 전송합니다(ThinkingSDK 버전 >= v3.0.1 필요)
- 계정 전환
계정을 전환한 후에는 login 인터페이스를 호출해야 합니다. SDK 내부에서 푸시 token을 userSet 인터페이스를 통해 새 계정으로 자동 전송합니다.
[TDAnalytics login:@"new_account_id"];
푸시 클릭 이벤트 수집
푸시 클릭 이벤트를 자동으로 전송하므로 수동 작업이 필요 없습니다.
JPush 푸시
"푸시 ID" 전송
- JPush 푸시 SDK를 통합하면 ThinkingSDK가 자동으로 전송합니다(ThinkingSDK 버전 >= v3.0.1 필요)
- 계정 전환
계정을 전환한 후에는 login 인터페이스를 호출해야 합니다. SDK 내부에서 푸시 token을 userSet 인터페이스를 통해 새 계정으로 자동 전송합니다.
[TDAnalytics login:@"new_account_id"];
푸시 클릭 이벤트 수집
푸시 클릭 이벤트를 자동으로 전송하므로 수동 작업이 필요 없습니다.
APNs 푸시
APNs 인증서를 얻는 방법은 APNs 인증서 획득 안내를 참고하십시오
"푸시 ID" 전송
APNs 채널은 현재 수동 전송만 지원합니다
- login을 호출하거나 계정을 전환한 후 APNs Device Token을 수동으로 업로드합니다.
// login 후 APNs Device Token을 다시 전송
[TDAnalytics login:@"test_id"];
// 예시: 시스템에 등록된 RemoteNotificationsWithDeviceToken 가져오기
NSString *token = [self getDviceTokenDemoFunction];
[TDAnalytics userSet:@{ @"#apns_token": token }];
APNs Device Token은 - application:didRegisterForRemoteNotificationsWithDeviceToken: 콜백에서 전송합니다
// SDK 초기화 후 APNs 콜백에서 APNs Device Token 전송
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
// 계정 전환 시 다시 전송할 수 있도록 여기서 APNs Device Token을 기록해 두는 것을 권장
NSString *token = [self formatDeviceTokenToHexStr:deviceToken];
[TDAnalytics userSet:@{ @"#apns_token": token }];
}
// (NSData *)deviceToken을 (NSString *)deviceToken으로 변환
- (NSString *)formatDeviceTokenToHexStr:(NSData *)deviceToken {
NSString *tokenStr;
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 13.0) {
const unsigned *tokenBytes = [deviceToken bytes];
tokenStr = [NSString stringWithFormat:@"%08x%08x%08x%08x%08x%08x%08x%08x",
ntohl(tokenBytes[0]), ntohl(tokenBytes[1]), ntohl(tokenBytes[2]),
ntohl(tokenBytes[3]), ntohl(tokenBytes[4]), ntohl(tokenBytes[5]),
ntohl(tokenBytes[6]), ntohl(tokenBytes[7])];
} else {
tokenStr = [[deviceToken description] stringByReplacingOccurrencesOfString:@"<" withString:@""];
tokenStr = [tokenStr stringByReplacingOccurrencesOfString:@">" withString:@""];
tokenStr = [tokenStr stringByReplacingOccurrencesOfString:@" " withString:@""];
}
return tokenStr;
}
- 계정 전환
계정을 전환한 후에는 login 인터페이스를 호출해야 합니다. SDK 내부에서 푸시 token을 userSet 인터페이스를 통해 새 계정으로 자동 전송합니다.
[TDAnalytics login:@"new_account_id"];
푸시 클릭 이벤트 수집
푸시 클릭 이벤트를 자동으로 전송하므로 수동 작업이 필요 없습니다.
푸시 클릭 수동 회수 방식
FCM 푸시
"푸시 ID" 전송
- login을 호출하거나 계정을 전환한 후 FCM의 Token을 업로드합니다.
NSString *appId = @"app-id";
NSString *serverUrl = @"server-url";
TDConfig *tdConfig = [[TDConfig alloc] initWithAppId:appId serverUrl:serverUrl];
[TDAnalytics startAnalyticsWithConfig:tdConfig];
[[FIRMessaging messaging] tokenWithCompletion:^(NSString *token, NSError *error) {
if (error != nil) {
NSLog(@"Error getting FCM registration token: %@", error);
} else {
NSLog(@"FCM registration token: %@", token);
[TDAnalytics userSet:@{@"fcm_token": token}];
}
}];
푸시 클릭 이벤트 수집
유저가 푸시 알림을 클릭하면 시스템의 푸시 클릭 콜백에서 푸시 클릭 이벤트를 보낼 수 있습니다.
// use <UserNotifications/UserNotifications.h> framework
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler {
NSDictionary *userInfo = response.notification.request.content.userInfo;
// trackAppOpenNotification 메서드 예시는 아래 '부록' 참고
[self trackAppOpenNotification:userInfo];
completionHandler();
}
JPush 푸시
"푸시 ID" 전송
- AE login을 호출하거나 계정을 전환한 후 JPush의 Registration ID를 업로드합니다.
// login 후 registrationID를 다시 전송
[TDAnalytics login:@"test_id"];
[TDAnalytics userSet:@{@"jiguang_id": registrationID}];
- JPush의 Registration ID는 - registrationIDCompletionHandler: 콜백에서 업로드합니다.
// AE SDK 초기화 후 JPush 콜백에서 registrationID 전송
[JPUSHService registrationIDCompletionHandler:^(int resCode, NSString *registrationID) {
[TDAnalytics userSet:@{@"jiguang_id": registrationID}];
}];
푸시 클릭 이벤트 수집
// iOS10 미만, 알림 클릭 콜백
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
[JPUSHService handleRemoteNotification:userInfo];
// trackAppOpenNotification 메서드 예시는 아래 '부록' 참고
[self trackAppOpenNotification:userInfo];
completionHandler(UIBackgroundFetchResultNewData);
}
// iOS10 이상, 알림 클릭 콜백
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler API_AVAILABLE(ios(10.0)){
// Required
NSDictionary *userInfo = response.notification.request.content.userInfo;
// trackAppOpenNotification 메서드 예시는 아래 '부록' 참고
[self trackAppOpenNotification:userInfo];
// 시스템에서 요구하는 메서드 실행
completionHandler();
}
APNs 푸시
"푸시 ID" 전송
- AE login을 호출하거나 계정을 전환한 후 APNs Device Token을 업로드합니다.
// login 후 APNs Device Token을 다시 전송
[TDAnalytics login:@"test_id"];
// 예시: 시스템에 등록된 RemoteNotificationsWithDeviceToken 가져오기
NSString *token = [self getDviceTokenDemoFunction];
[TDAnalytics userSet:@{ @"#apns_token": token }];
- APNs Device Token은 - application:didRegisterForRemoteNotificationsWithDeviceToken: 콜백에서 전송합니다
// SDK 초기화 후 APNs 콜백에서 APNs Device Token 전송
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
// 계정 전환 시 다시 전송할 수 있도록 여기서 APNs Device Token을 기록해 두는 것을 권장
NSString *token = [self formatDeviceTokenToHexStr:deviceToken];
[TDAnalytics userSet:@{ @"#apns_token": token }];
}
// (NSData *)deviceToken을 (NSString *)deviceToken으로 변환
- (NSString *)formatDeviceTokenToHexStr:(NSData *)deviceToken {
NSString *tokenStr;
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 13.0) {
const unsigned *tokenBytes = [deviceToken bytes];
tokenStr = [NSString stringWithFormat:@"%08x%08x%08x%08x%08x%08x%08x%08x",
ntohl(tokenBytes[0]), ntohl(tokenBytes[1]), ntohl(tokenBytes[2]),
ntohl(tokenBytes[3]), ntohl(tokenBytes[4]), ntohl(tokenBytes[5]),
ntohl(tokenBytes[6]), ntohl(tokenBytes[7])];
} else {
tokenStr = [[deviceToken description] stringByReplacingOccurrencesOfString:@"<" withString:@""];
tokenStr = [tokenStr stringByReplacingOccurrencesOfString:@">" withString:@""];
tokenStr = [tokenStr stringByReplacingOccurrencesOfString:@" " withString:@""];
}
return tokenStr;
}
푸시 클릭 이벤트 수집
// iOS10 미만, 알림 클릭 콜백
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
// trackAppOpenNotification 메서드 예시는 아래 '부록' 참고
[self trackAppOpenNotification:userInfo];
completionHandler(UIBackgroundFetchResultNewData);
}
// iOS10 이상, 알림 클릭 콜백
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler {
NSDictionary *userInfo = response.notification.request.content.userInfo;
// trackAppOpenNotification 메서드 예시는 아래 '부록' 참고
[self trackAppOpenNotification:userInfo];
// 시스템에서 요구하는 메서드 실행
completionHandler();
}
메시지 도달 이벤트 수집
알림 확장 target에 다음 코드를 추가합니다
#import <ThinkingDataPushExtension/ThinkingDataPushExtension.h>
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
self.contentHandler = contentHandler;
self.bestAttemptContent = [request.content mutableCopy];
NSString *appId = @"your app id in TE";
NSString *serverUrl = @"your server url in TE";
NSString *accountId = @"user account id. AccountId and DistinctId cannot be empty at the same time";
NSString *distinctId = @"user distinct id. AccountId and DistinctId cannot be empty at the same time";
BOOL result = [TDPushExtension handleNotificationRequest:request withContentHandler:contentHandler appId:appId serverUrl:serverUrl accountId:accountId distinctID:distinctId];
if (result) {
return;
}
self.contentHandler(self.bestAttemptContent);
}
파라미터 설명:
- appId: AE 백엔드에서 프로젝트의 APP ID를 확인할 수 있습니다
- serverUrl: AE 백엔드에서 프로젝트의 receiver url을 확인할 수 있습니다
- accountId: 운영 백엔드에서 패스스루 파라미터를 설정한 후, 여기서 accountId를 직접 파싱해야 합니다
- distinctId: 운영 백엔드에서 패스스루 파라미터를 설정한 후, 여기서 distinctId를 직접 파싱해야 합니다
운영 백엔드 설정 위치: AE 백엔드의 운영 → 운영 설정 → 채널 설정 → 메시지 푸시에서 APNs 채널을 새로 생성하거나 편집합니다(FCM, JPush 채널도 동일). 채널 설정 드로어 하단의 패스스루 파라미터에 다음을 추가합니다.
푸시 메시지 처리
FCM 푸시
유저가 푸시 알림을 클릭하면 시스템의 푸시 클릭 콜백에서 푸시 파라미터를 가져올 수 있습니다.
다음 두 가지 방식 중 하나를 선택할 것을 권장합니다.
- 메시지 타입 파싱: handleTEPushAction 메서드를 호출합니다.
- 패스스루 파라미터 파싱: handleTEPassThroughAction 메서드를 호출합니다.
// use <UserNotifications/UserNotifications.h> framework
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler {
NSDictionary *userInfo = response.notification.request.content.userInfo;
//일반 파라미터를 처리하는 경우 다음 메서드를 호출
[self handleTEPushAction:userInfo];
//패스스루 파라미터를 처리하는 경우 다음 메서드를 호출
[self handleTEPassThroughAction:userInfo];
completionHandler();
}
JPush 푸시
다음 두 가지 방식 중 하나를 선택할 것을 권장합니다.
- 메시지 타입 파싱: handleTEPushAction 메서드를 호출합니다.
- 패스스루 파라미터 파싱: handleTEPassThroughAction 메서드를 호출합니다.
// iOS10 미만, 알림 클릭 콜백
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
// Required, iOS 7 Support
[JPUSHService handleRemoteNotification:userInfo];
//일반 파라미터를 처리하는 경우 다음 메서드를 호출
[self handleTEPushAction:userInfo];
//패스스루 파라미터를 처리하는 경우 다음 메서드를 호출
[self handleTEPassThroughAction:userInfo];
completionHandler(UIBackgroundFetchResultNewData);
}
// iOS10 이상, 알림 클릭 콜백
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler API_AVAILABLE(ios(10.0)){
// Required
NSDictionary *userInfo = response.notification.request.content.userInfo;
//일반 파라미터를 처리하는 경우 다음 메서드를 호출
[self handleTEPushAction:userInfo];
//패스스루 파라미터를 처리하는 경우 다음 메서드를 호출
[self handleTEPassThroughAction:userInfo];
// 시스템에서 요구하는 메서드 실행
completionHandler();
}
APNs 푸시
다음 두 가지 방식 중 하나를 선택할 것을 권장합니다.
- 일반 파라미터: handleTEPushAction 메서드를 호출합니다.
- 패스스루 파라미터: handleTEPassThroughAction 메서드를 호출합니다.
// iOS10 미만, 알림 클릭 콜백
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
//일반 파라미터를 처리하는 경우 다음 메서드를 호출
[self handleTEPushAction:userInfo];
//패스스루 파라미터를 처리하는 경우 다음 메서드를 호출
[self handleTEPassThroughAction:userInfo];
completionHandler(UIBackgroundFetchResultNewData);
}
// iOS10 이상, 알림 클릭 콜백
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler {
NSDictionary *userInfo = response.notification.request.content.userInfo;
//일반 파라미터를 처리하는 경우 다음 메서드를 호출
[self handleTEPushAction:userInfo];
//패스스루 파라미터를 처리하는 경우 다음 메서드를 호출
[self handleTEPassThroughAction:userInfo];
// 시스템에서 요구하는 메서드 실행
completionHandler();
}
푸시 이미지 표시
알림 확장 target에 ThinkingDataPushExtension SDK를 통합해야 합니다. 이미 메시지 도달 이벤트 수집을 추가했다면 이 작업을 반복할 필요가 없습니다.
알림 확장 target에 다음 코드를 추가합니다
#import <ThinkingDataPushExtension/ThinkingDataPushExtension.h>
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
self.contentHandler = contentHandler;
self.bestAttemptContent = [request.content mutableCopy];
NSString *appId = @"your app id in TE";
NSString *serverUrl = @"your server url in TE";
NSString *accountId = @"user account id. AccountId and DistinctId cannot be empty at the same time";
NSString *distinctId = @"user distinct id. AccountId and DistinctId cannot be empty at the same time";
BOOL result = [TDPushExtension handleNotificationRequest:request withContentHandler:contentHandler appId:appId serverUrl:serverUrl accountId:accountId distinctID:distinctId];
if (result) {
return;
}
self.contentHandler(self.bestAttemptContent);
}
파라미터 설명:
- appId: AE 백엔드에서 프로젝트의 APP ID를 확인할 수 있습니다
- serverUrl: AE 백엔드에서 프로젝트의 receiver url을 확인할 수 있습니다
- accountId: 운영 백엔드에서 패스스루 파라미터를 설정한 후, 여기서 accountId를 직접 파싱해야 합니다
- distinctId: 운영 백엔드에서 패스스루 파라미터를 설정한 후, 여기서 distinctId를 직접 파싱해야 합니다
운영 백엔드 설정 위치: AE 백엔드의 운영 → 운영 설정 → 채널 설정 → 메시지 푸시에서 APNs 채널을 새로 생성하거나 편집합니다(FCM, JPush 채널도 동일). 채널 설정 드로어 하단의 패스스루 파라미터에 다음을 추가합니다.
부록
클라이언트가 수신하는 푸시 파라미터 예시
다음은 클라이언트가 수신하는 확장 필드 파라미터만 보여 줍니다
{
"te_extras": {
//푸시 클릭 시 이동 방식
"ops_loading_type": "OPEN_APP",
//패스스루 파라미터
"passthrough_params": {
"param1": "abc",
"param2": 101,
"param3": [{
"subText1": "xyz",
"subText2": 2
}]
},
//AE 운영 채널 회신 속성
"#ops_receipt_properties": {
"ops_task_id": "0082",
"ops_project_id": 1,
"ops_task_instance_id": "0082_20230331",
"ops_push_language": "default",
"ops_task_exec_detail_id": "55"
}
}
}
고객의 푸시 회수 경로 연동 성공 여부를 확인하는 방법
- 푸시를 연동한 후 처음 실행하거나 푸시 token이 변경될 때 다음 이벤트가 전송되는지 확인합니다.
{"#type": "user_set","#time": "2023-11-13 15:50:55.729","#distinct_id": "distinct","properties": {"jiguang_id": "190e35f7e15c8481caa"},"#uuid": "9f233c31-a664-46ff-94d6-f767a3098c3a"}
- 푸시 알림을 클릭하여 앱을 실행한 후 te_ops_push_click 이벤트가 업로드되는지, 이벤트 속성에 #ops_receipt_properties가 포함되어 있는지 확인합니다.
{"#type": "track","#time": "2023-03-16 16:08:32.191","#distinct_id": "90d80464-6832-43f1-80d9-bd93fc09c4fe","#event_name": "te_ops_push_click","properties": {"#lib_version": "3.0.1-beta.1","#carrier": "中国移动","#os": "Android","#device_id": "6262ca7f71e6aca3","#screen_height": 2400,"#bundle_id": "cn.thinkingdata.random","#device_model": "M2012K11AC","#screen_width": 1080,"#system_language": "zh","#install_time": "2023-03-10 11:24:44.285","#simulator": false,"#lib": "Android","#manufacturer": "Xiaomi","#os_version": "11","#app_version": "1.0","#fps": 60,"#network_type": "WIFI","#ram": "2.7\/7.4","#disk": "4.6\/106.3","#device_type": "Phone","#ops_receipt_properties": {"ops_project_id": 1,"ops_request_id": "3b21d2a8-8d3d-44fa-b460-3bb311ed3bcd"},"#zone_offset": 8},"#uuid": "7a977e23-b78a-4433-baae-ead17ad2fde9"}
trackAppOpenNotification
푸시 클릭 이벤트
- (void)trackAppOpenNotification:(NSDictionary *)userInfo{
@try {
if ([userInfo.allKeys containsObject:@"te_extras"] && [userInfo[@"te_extras"] isKindOfClass:[NSString class]]) {
NSData *jsonData = [userInfo[@"te_extras"] dataUsingEncoding:NSUTF8StringEncoding];
NSError *err;
NSDictionary *responseDic = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&err];
NSDictionary *opsReceiptProperties = responseDic[@"#ops_receipt_properties"];
if ([opsReceiptProperties isKindOfClass:[NSString class]]) {
NSString *opsStr = (NSString *)opsReceiptProperties;
opsReceiptProperties = [NSJSONSerialization JSONObjectWithData:[opsStr dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&err];
}
if (opsReceiptProperties && [opsReceiptProperties isKindOfClass:[NSDictionary class]]) {
NSMutableDictionary *pushProperties = [NSMutableDictionary dictionary]; // track 딕셔너리
pushProperties[@"#ops_receipt_properties"] = opsReceiptProperties;
[TDAnalytics track:@"te_ops_push_click" properties:pushProperties];
[TDAnalytics flush];
}
}
} @catch (NSException *exception) {
}
}
handleTEPushAction
푸시 메시지 타입 파싱
- (void)handleTEPushAction:(NSDictionary *)userInfo{
@try {
NSString *jsonString = userInfo[@"te_extras"];
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSError *error;
NSDictionary *sfDictionary = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error];
if (!sfDictionary || error) {
return;
}
NSString *sf_landing_type = sfDictionary[@"ops_loading_type"];
if ([sf_landing_type isEqualToString:@"OPEN_APP"]) {
// App 열기
}
else if ([sf_landing_type isEqualToString:@"OPEN_URL"]) {
// URL 열기
NSString *url = sfDictionary[@"ops_url"];
}
else if ([sf_landing_type isEqualToString:@"CUSTOMIZED"]) {
// 커스텀 메시지 처리
NSString *customized = sfDictionary[@"ops_customized"];
}
} @catch (NSException *exception) {
}
}
handleTEPassThroughAction
패스스루 파라미터 파싱
- (void)handleTEPassThroughAction:(NSDictionary *)userInfo{
@try {
NSString *jsonString = userInfo[@"te_extras"];
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSError *error;
NSDictionary *sfDictionary = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error];
if (!sfDictionary || error) {
return;
}
NSString *params = sfDictionary[@"passthrough_params"];
if (params) {
// params는 패스스루 파라미터이며, 이어서 구체적인 비즈니스 로직을 구현합니다
}
} @catch (NSException *exception) {
}
}

