푸시 스토리
Braze SDK용 푸시 스토리를 설정하는 방법을 알아보세요.
Prerequisites
Before you can use this feature, you’ll need to integrate the Cordova Braze SDK. 또한 푸시 알림을 설정해야 하며, 여기에는 UNNotification
프레임워크 구현이 포함됩니다.
푸시 스토리를 수신하려면 다음 SDK 버전이 필요합니다.
푸시 스토리 설정하기
1단계: 알림 콘텐츠 확장 대상 추가
앱 프로젝트에서 메뉴 파일 > 새로 만들기 > 타겟로 이동하여 새 Notification Content Extension
타겟을 추가하고 활성화하세요.
Xcode가 새 대상을 자동으로 생성하고 다음을 포함하여 파일을 자동으로 생성합니다.
NotificationViewController.swift
MainInterface.storyboard
2단계: 기능 활성화
Xcode에서 서명 및 기능 창을 사용하여 백그라운드 모드 기능을 기본 앱 대상에 추가합니다. 백그라운드 가져오기 및 원격 알림 체크박스를 모두 선택합니다.
앱 그룹 추가
또한 Xcode의 서명 및 기능 창에서 기본 앱 대상과 알림 콘텐츠 확장 대상에 앱 그룹 기능을 추가합니다. 그런 다음 + 버튼을 클릭합니다. 앱의 번들 ID를 사용하여 앱 그룹을 만드십시오. 예를 들어 앱의 번들 ID가 com.company.appname
인 경우 앱 그룹 이름을 group.com.company.appname.xyz
로 지정할 수 있습니다.
이 컨텍스트에서 앱 그룹은 Braze 워크스페이스(이전 앱 그룹) ID가 아닌 Apple의 앱 그룹 권한을 의미합니다.
앱을 앱 그룹에 추가하지 않으면 푸시 페이로드에서 특정 필드를 채우지 못하고 예상대로 완전히 작동하지 않을 수 있습니다.
3단계: 앱 {#enable-capabilities}에 푸시 스토리 프레임워크 추가
포드파일에 다음 줄을 추가합니다:
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 Extension
에 BrazePushStory.xcframework
를 추가합니다.
Do Not Embed이(가) Embed 열의 BrazePushStory.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 Extension
의 Info.plist
파일을 열고 NSExtension \ NSExtensionAttributes
아래에서 다음 키를 추가 및 변경합니다.
키 | 유형 | 값 |
---|---|---|
UNNotificationExtensionCategory |
문자열 | ab_cat_push_story_v2 |
UNNotificationExtensionDefaultContentHidden |
부울 | YES |
UNNotificationExtensionInitialContentSizeRatio |
숫자 | 0.6 |
UNNotificationExtensionUserInteractionEnabled |
부울 | YES |
귀하의 Info.plist
파일은 다음 이미지와 일치해야 합니다:
6단계: 주요 앱 {#update-braze}에서 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)
Prerequisites
Before you can use this feature, you’ll need to integrate the Cordova Braze SDK. You’ll also need to set up push notifications.
Setting up push stories
Step 1: Create a notification content extension
In your Xcode project, create a notification content extension. For a full walkthrough, see iOS Push Stories Tutorial.
Step 2: Configure your push app group
In your project’s config.xml
file, configure the push app group you just created.
1
<preference name="com.braze.ios_push_app_group" value="NOTIFICATION_CONTENT_EXTENTION" />
Replace PUSH_APP_GROUP
with the name of your push app group. Your config.xml
should be similar to the following:
1
<preference name="com.braze.ios_push_app_group" value="MyPushAppGroup" />
Step 3: Add a new target
Open your Podfile and add BrazePushStory
to the notification content extension target you created previously. To avoid duplicate symbol errors, use static linking.
1
2
3
4
target 'NOTIFICATION_CONTENT_EXTENSION' do
use_frameworks! :linkage => :static
pod 'BrazePushStory'
end
Replace NOTIFICATION_CONTENT_EXTENSION
with the name of your notification content extension. Your Podfile should be similar to the following:
1
2
3
4
target 'MyAppNotificationContentExtension' do
use_frameworks! :linkage => :static
pod 'BrazePushStory'
end
Step 4: Reinstall your CocoaPods dependencies
In the terminal, go to your iOS directory and reinstall your CocoaPod dependencies.
1
2
cd PATH_TO_PROJECT/platform/ios
pod install
Prerequisites
Before you can use this feature, you’ll need to integrate the React Native Braze SDK. 푸시 알림도 설정해야 합니다.
푸시 스토리 활성화
리액트 네이티브 SDK의 경우 푸시 스토리는 기본적으로 안드로이드에서 사용할 수 있습니다.
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 애플리케이션 서비스에서 앱 확장 사용을 참조하세요.
Expo 애플리케이션 서비스와 함께 푸시 스토리를 사용하는 경우 eas build
를 실행할 때 EXPO_NO_CAPABILITY_SYNC=1
플래그를 사용해야 합니다. 확장의 프로비저닝 프로필에서 앱 그룹 기능이 제거되는 것은 명령줄의 알려진 문제입니다.