Wisetracker Docs
웹사이트블로그콘솔 바로가기도입 문의이용 문의
🧑‍💻 개발자 가이드
🧑‍💻 개발자 가이드
  • 와이즈트래커 개발자 가이드
  • quick start
    • 앱 광고 트래킹을 위한 필수 지식
    • SDK 설정 전 기초 진단
    • SDK 설정 후 체크리스트
      • Android
      • iOS
      • ReactNative
      • Flutter
      • Unity
      • Cordova
      • Cocos2d-x
      • Web
    • SDK 데이터 검증
    • 이벤트 발생 현황
  • SDK 연동
    • Android
      • SDK 삽입
      • 필수 이벤트 설정
      • App Link 설정
      • Android 12 ADID 변경사항
    • iOS
      • SDK 삽입
      • 필수 이벤트 설정
      • App Store '개인정보 세부 사항' 가이드
      • Universal Link 설정
    • HybridApp WebView
      • SDK 삽입
      • 필수 이벤트 설정
    • React Native
      • React Native 플러그인 연동
      • 인앱 분석 API
      • AOS 데이터 검증
      • iOS 데이터 검증
    • Flutter
      • Flutter 플러그인 연동
      • AOS 데이터 검증
      • iOS 데이터 검증
    • Unity
      • Unity 플러그인 연동
      • 인앱 이벤트 API
      • AOS 데이터 검증
      • iOS 데이터 검증
    • Website
      • Javascript SDK Integration
      • 웹사이트 이벤트 분석하기
    • CPC 광고 분석 연동
      • Web-To-App SDK 적용
      • App 으로 이동시키기
  • 앱심사 개인정보 처리 가이드
    • SDK 개인정보 처리 가이드
  • SDK 데이터 검증
    • Android 데이터 검증
    • iOS 데이터 검증
    • 웹사이트 데이터 검증
  • In-App Event
    • 인앱 이벤트 설정
      • 페이지 분석
      • 커스텀 차원(Custom Dimension)
    • 인앱 이벤트 리스트
      • Basic : 공통 이벤트
      • Messaging : 푸시/인앱 메시지
      • e-Commerce : 이커머스
      • Education : 교육
      • Travel : 여행 및 레저
      • Entertainment : 엔터테인먼트
      • Game : 게임
      • Fintech : 금융
      • Mobility : 모빌리티
    • 인앱 이벤트 태깅(Tagging)
  • Google Tag Manager 연동
    • 연동 방법
  • Server-to-Server 연동
    • 연동 방법
    • 연동 이벤트
    • 연동 데이터 요약
  • 푸시메세지 가이드
    • 앱 푸시메시지 연동
      • Android
        • FCM 인증서 설정
        • 대시보드 설정
        • SDK 설치 및 API 적용
        • 푸시 알림 데이터 이용
      • iOS
        • APNS 설정
        • 대시보드 설정
        • SDK 설치 및 API 적용
        • 푸시 알림 데이터 이용
      • React Native
        • 준비 사항 안내
        • Android 기초 설정
        • iOS 기초 설정
        • ReactNative 푸시메세지 설정
      • Flutter
        • 준비 사항 안내
        • Android 기초 설정
        • iOS 기초 설정
        • Flutter 푸시메세지 설정
    • 푸시 알림 데이터 이용
Powered by GitBook
On this page
  • 딥링크 데이터 이용시 주의사항
  • 앱이 포그라운드 상태일 때
  • jsonDict 에 포함된 데이터 Key/Value
  • 앱이 백그라운드 상태일 때

Was this helpful?

  1. 푸시메세지 가이드
  2. 앱 푸시메시지 연동
  3. iOS

푸시 알림 데이터 이용

푸시 알림 메시지가 수신되거나 사용자에 의해 탭될 때 호출되는 메쏘드와 해당 상황에서 데이터를 추출하여 이용하는 방법에 대해 안내합니다.

앱이 포그라운드 상태일 때 화면에 알림 메시지가 보여지도록 구현하지 않은 이상 화면에 배너 형태로 알림 메시지가 보이지 않습니다.

앱이 포그라운드 상태인데 화면에 배너 형태로 알림 메시지가 보인다면 이미 고객님께서 알림 메시지가 보여지도록 구현한 것입니다. 이 경우, 해당 구현부분 상단에 아래의 내용을 참조하여 수정해주셔야 합니다.

알림 메시지가 보이지 않거나 Delegation 메쏘드가 구현되지 않은 경우에는 아래 내용 참고하셔서 해당 메쏘드를 추가하여 데이터를 추출할 수 있습니다.

딥링크 데이터 이용시 주의사항

딥링크 데이터를 이용할 때 아래와 같은 점에 유의해주세요.

  1. 앱이 Foreground상태일 때 딥링크 URL로 화면이 바로 이동하면 이용자가 당황스러울 수 있습니다. 이에 대해 기획단계부터 어떻게 할 것인지 고민해주세요. 보통은 로컬 노티피케이션을 한 번 더 띄우기도 합니다.

  2. 앱의 세 가지 상태 (Foreground, Background, Killed)에 따라 작동 매카니즘이 다릅니다. 각 상태별로 호출 구조를 체크해주세요.

위에서 딥링크와 관련해서 안내드렸는데요, 푸시를 통해 전달되는 데이터를 이용하는 것에 모두 해당되는 내용입니다.

앱이 포그라운드 상태일 때

AppDelegate 의 "userNotificationCenter(_:willPresent:withCompletionHandler:):" 메쏘드가 호출됩니다.

// UNUserNotificationCenterDelegate 프로토콜 구현
@main
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
  ...
  func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
    print("userInfo: \(notification.request.content.userInfo)")
    if let rootDict = notification.request.content.userInfo as NSDictionary? {
      if let jsonDict = rootDict["RW_push_payload_WP"] as? NSDictionary {
        let title = jsonDict["RW_push_payload_TT"]
        let body = jsonDict["RW_push_payload_BD"]
        let deepLink = jsonDict["RW_push_payload_deeplink"]
        
        print("Notification title: \(title), body: \(body), deepLink: \(deepLink)")
      }
    }
    completionHandler([.sound, .badge])
  }
  ...
}
// 앱 포그라운드 상태일 때 알림
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler  API_AVAILABLE(ios(10.0)) {
    NSDictionary *userInfo = notification.request.content.userInfo;
    NSLog(@"푸시 데이터 : %@", userInfo);

    NSDictionary *jsonDict = [dictionary objectForKey:@"RW_push_payload_WP"];
    if (jsonDict != nil) {
        String *title = [jsonDict objectForKey:@"RW_push_payload_TT"];
        String *body = [jsonDict objectForKey:@"RW_push_payload_BD"];
        String *deepLink = [jsonDict objectForKey:@"RW_push_payload_deeplink"];
        NSLog("Notification title: %@, body: %@, deepLink: %@", title, body, deepLink);
    }

    completionHandler(UNNotificationPresentationOptionNone);    // 포그라운드 상태에서 푸시왔을 때 푸시 마노출
//  completionHandler(UNNotificationPresentationOptionAlert);   // 포그라운드 상태에서 푸시왔을 때 푸시 노출
}

jsonDict 에 포함된 데이터 Key/Value

jsonDict 는 일반 문자열입니다. 해당 문자열은 JSON 형식으로 되어있으니 사용하시는 JSON Parser를 이용하여 JSON 객체로 전환하여 사용해주세요.

  • 최상위 객체의 구조

최상위 Payload 키
Payload 값
필수여부

RW_push_payload_WP

Sub객체 (아래 Sub객체 참조)

필수

  • Sub객체의 구조

Payload 키
Payload 값
필수여부

RW_push_payload_TT

메시지 타이틀

필수

RW_push_payload_BD

메시지 내용

필수

RW_push_payload_IM

이미지 URL

X

RW_push_payload_MV

유튜브 동영상 URL

X

RW_push_payload_deeplink

딥링크 URL

X

앱이 백그라운드 상태일 때

앱이 백그라운드이거나 Killed 된 상태인 경우, 위의 메쏘드가 호출되지 않습니다.

알림 메시지는 앱이 백그라운드 상태에서 알림 표시줄에 배너 형태 등으로 표시됩니다. 해당 알림 메시지를 탭하면 아래와 같은 "userNotificationCenter(_:didReceive:withCompletionHandler:)" 메쏘드가 호출됩니다. 해당 메쏘드에서 데이터를 추출하여 사용합니다.

// UNUserNotificationCenterDelegate 프로토콜 구현
@main
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
  ...
  func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
    print("userInfo: \(response.notification.request.content.userInfo)")
    if let rootDict = response.notification.request.content.userInfo as NSDictionary? {
      if let jsonDict = rootDict["RW_push_payload_WP"] as? NSDictionary {
        let title = jsonDict["RW_push_payload_TT"]
        let body = jsonDict["RW_push_payload_BD"]
        let deepLink = jsonDict["RW_push_payload_deeplink"]
        
        print("Notification title: \(title), body: \(body), deepLink: \(deepLink)")
      }
    }
    completionHandler()
  }
  ...
}
// 앱 백라운드 상태일 때 알림
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler  API_AVAILABLE(ios(10.0)){
    NSDictionary *userInfo = response.notification.request.content.userInfo;
    NSLog(@"푸시 데이터 : %@", userInfo);

    NSDictionary *jsonDict = [dictionary objectForKey:@"RW_push_payload_WP"];
    if (jsonDict != nil) {
        String *title = [jsonDict objectForKey:@"RW_push_payload_TT"];
        String *body = [jsonDict objectForKey:@"RW_push_payload_BD"];
        String *deepLink = [jsonDict objectForKey:@"RW_push_payload_deeplink"];
        NSLog("Notification title: %@, body: %@, deepLink: %@", title, body, deepLink);
    }

    completionHandler();
}
PreviousSDK 설치 및 API 적용NextReact Native

Last updated 2 years ago

Was this helpful?