Skip to content

푸시 스토리

Braze SDK용 푸시 스토리를 설정하는 방법을 알아보세요.

필수 조건

이 기능을 사용하려면 먼저 Swift Braze SDK를 통합해야 합니다. 또한 푸시 알림을 설정해야 하며, 여기에는 UNNotification 프레임워크 구현이 포함됩니다.

Push Stories를 수신하려면 다음 최소 SDK 버전이 필요합니다:

Push Stories 설정

1단계: 알림 콘텐츠 확장 타겟 추가

앱 프로젝트에서 메뉴 File > New > Target으로 이동하여 새 Notification Content Extension 타겟을 추가하고 활성화합니다.

Xcode가 새 타겟을 자동으로 생성하고 다음 파일을 자동으로 만들어 줍니다:

  • NotificationViewController.swift
  • MainInterface.storyboard

2단계: 기능 활성화

Xcode에서 메인 앱 타겟의 Signing & Capabilities 패널을 사용하여 Background Modes 기능을 추가합니다. Background fetchRemote notifications 체크박스를 모두 선택합니다.

앱 그룹 추가

또한 Xcode의 Signing & Capabilities 패널에서 메인 앱 타겟과 알림 콘텐츠 확장 타겟에 App Groups 기능을 추가합니다. 그런 다음 + 버튼을 클릭합니다. 앱의 번들 ID를 사용하여 앱 그룹을 만듭니다. 예를 들어 앱의 번들 ID가 com.company.appname인 경우 앱 그룹 이름을 group.com.company.appname.xyz로 지정할 수 있습니다.

앱을 앱 그룹에 추가하지 않으면 푸시 페이로드에서 특정 필드를 채우지 못하고 예상대로 완전히 작동하지 않을 수 있습니다.

3단계: 앱에 Push Story 프레임워크 추가

스위프트 패키지 매니저 통합 가이드를 수행한 후 Notification Content ExtensionBrazePushStory를 추가합니다.

Xcode에서 프레임워크 및 라이브러리 아래에 있는 "+" 아이콘을 선택하여 프레임워크를 추가합니다.

Podfile에 다음 줄을 추가합니다:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
target 'YourAppTarget' do
pod 'BrazeKit'
pod 'BrazeUI'
pod 'BrazeLocation'
end

target 'YourNotificationContentExtensionTarget' do
pod 'BrazePushStory'
end

# Only include the below if you want to also integrate Rich Push
target 'YourNotificationServiceExtensionTarget' do
pod 'BrazeNotificationService'
end

Podfile을 업데이트한 후 터미널에서 Xcode 앱 프로젝트의 디렉토리로 이동하고 pod install을 실행합니다.

GitHub 릴리스 페이지에서 최신 BrazePushStory.zip을 다운로드하여 압축을 푼 후 프로젝트의 Notification Content ExtensionBrazePushStory.xcframework를 추가합니다.

4단계: 알림 뷰 컨트롤러 업데이트

NotificationViewController.swift에서 헤더 파일을 가져오기 위해 다음 줄을 추가합니다:

1
import BrazePushStory

다음으로, BrazePushStory.NotificationViewController를 상속하여 기본 구현을 대체합니다:

1
class NotificationViewController: BrazePushStory.NotificationViewController {}

푸시 스토리 이벤트 커스텀 처리

푸시 스토리 알림 이벤트를 처리하기 위해 자체 커스텀 로직을 구현하려면 위와 같이 BrazePushStory.NotificationViewController를 상속하고 아래와 같이 didReceive 메서드를 재정의합니다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import BrazePushStory
import UserNotifications
import UserNotificationsUI

class NotificationViewController: BrazePushStory.NotificationViewController {
  override func didReceive(_ notification: UNNotification) {
    super.didReceive(notification)

    // Custom handling logic
  }

  override func didReceive(_ response: UNNotificationResponse, completionHandler completion: @escaping (UNNotificationContentExtensionResponseOption) -> Void) {
    super.didReceive(response, completionHandler: completion)

    // Custom handling logic
  }
}

5단계: 알림 콘텐츠 확장 plist 설정

Notification Content ExtensionInfo.plist 파일을 열고 NSExtension \ NSExtensionAttributes 아래에서 다음 키를 추가 및 변경합니다:

유형
UNNotificationExtensionCategory 문자열 ab_cat_push_story_v2
UNNotificationExtensionDefaultContentHidden 부울 YES
UNNotificationExtensionInitialContentSizeRatio 숫자 0.6
UNNotificationExtensionUserInteractionEnabled 부울 YES

또한 동일한 Info.plist 파일에 다음 최상위 Braze 사전을 추가하고, REPLACE_WITH_APPGROUP2단계에서 생성한 앱 그룹으로 대체합니다:

유형
Braze.AppGroup 문자열 REPLACE_WITH_APPGROUP

Info.plist 파일은 다음 이미지와 일치해야 합니다:

6단계: 메인 앱에서 Braze 통합 업데이트

Braze를 초기화하기 전에 앱 그룹의 이름을 Braze 구성의 push.appGroup 속성에 할당합니다.

1
2
3
4
let configuration = Braze.Configuration(apiKey: "<YOUR-BRAZE-API-KEY>",
                                        endpoint: "<YOUR-BRAZE-ENDPOINT>")
configuration.push.appGroup = "REPLACE_WITH_APPGROUP"
let braze = Braze(configuration: configuration)

필수 조건

이 기능을 사용하려면 먼저 Cordova Braze SDK를 통합해야 합니다. 푸시 알림도 설정해야 합니다.

푸시 스토리 설정하기

1단계: 알림 콘텐츠 확장 생성

Xcode 프로젝트에서 알림 콘텐츠 확장을 생성합니다. 전체 안내는 iOS 푸시 스토리 튜토리얼을 참조하세요.

2단계: 푸시 앱 그룹 구성

프로젝트의 config.xml 파일에서 방금 만든 푸시 앱 그룹을 구성합니다.

1
<preference name="com.braze.ios_push_app_group" value="NOTIFICATION_CONTENT_EXTENTION" />

PUSH_APP_GROUP 을 푸시 앱 그룹의 이름으로 바꿉니다. config.xml 은 다음과 유사해야 합니다:

1
<preference name="com.braze.ios_push_app_group" value="MyPushAppGroup" />

3단계: 새 대상 추가

Podfile을 열고 이전에 생성한 알림 콘텐츠 서비스 확장 대상에 BrazePushStory를 추가합니다. 중복된 심볼 오류를 방지하려면 정적 링크를 사용하세요.

1
2
3
4
target 'NOTIFICATION_CONTENT_EXTENSION' do
  use_frameworks! :linkage => :static
  pod 'BrazePushStory'
end

NOTIFICATION_CONTENT_EXTENSION 을 알림 콘텐츠 확장자의 이름으로 바꿉니다. 팟파일은 다음과 비슷해야 합니다:

1
2
3
4
target 'MyAppNotificationContentExtension' do
  use_frameworks! :linkage => :static
  pod 'BrazePushStory'
end

4단계: CocoaPods 종속성 다시 설치

터미널에서 iOS 디렉토리로 이동하여 CocoaPod 종속성을 다시 설치합니다.

1
2
cd PATH_TO_PROJECT/platform/ios
pod install

필수 조건

이 기능을 사용하려면 먼저 React Native Braze SDK를 통합해야 합니다. 푸시 알림을 설정해야 합니다.

푸시 스토리 활성화

React Native SDK의 경우, 푸시 스토리는 Android에서 기본값으로 제공됩니다.

Expo를 사용하여 iOS에서 푸시 스토리를 활성화하려면 애플리케이션에 대한 앱 그룹이 정의되어 있는지 확인합니다. 자세한 내용은 앱 그룹 추가하기를 참조하세요.

그런 다음, enableBrazeIosPushStories 속성정보를 true로 구성하고 app.json에 있는 expo.plugins 오브젝트의 iosPushStoryAppGroup에 앱 그룹 ID를 할당합니다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
  "expo": {
    "plugins": [
      [
        "@braze/expo-plugin",
        {
          ...
          "enableBrazeIosPushStories": true,
          "iosPushStoryAppGroup": "group.com.company.myApp.PushStories"
        }
      ]
    ]
  }
}

마지막으로, 프로젝트의 자격 증명 구성에 이 앱 확장에 대한 번들 식별자를 추가합니다. <your-app-bundle-id>.BrazeExpoPushStories. 이 프로세스에 대한 자세한 내용은 Expo 애플리케이션 서비스에서 앱 확장 사용을 참조하세요.

New Stuff!