Skip to content


Content Cards 통합

Content Cards 데이터 모델

Content Cards 데이터 모델은 iOS SDK에서 사용할 수 있습니다.

데이터 가져오기

Content Cards 데이터 모델에 액세스하려면 Content Cards 업데이트 이벤트를 구독합니다.

1
2
3
4
5
6
// Subscribe to Content Cards updates
// Note: you should remove the observer where appropriate
[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(contentCardsUpdated:)
                                             name:ABKContentCardsProcessedNotification
                                           object:nil];
1
2
3
4
5
6
7
// Called when Content Cards are refreshed (via `requestContentCardsRefresh`)
- (void)contentCardsUpdated:(NSNotification *)notification {
  BOOL updateIsSuccessful = [notification.userInfo[ABKContentCardsProcessedIsSuccessfulKey] boolValue];
  if (updateIsSuccessful) {
    // get the cards using [[Appboy sharedInstance].contentCardsController getContentCards];
  }
}
1
2
3
4
5
// Subscribe to content card updates
// Note: you should remove the observer where appropriate
NotificationCenter.default.addObserver(self, selector:
  #selector(contentCardsUpdated),
  name:NSNotification.Name.ABKContentCardsProcessed, object: nil)
1
2
3
4
5
6
7
8
// Called when the Content Cards are refreshed (via `requestContentCardsRefresh`)
@objc private func contentCardsUpdated(_ notification: Notification) {
  if let updateIsSuccessful = notification.userInfo?[ABKContentCardsProcessedIsSuccessfulKey] as? Bool {
    if (updateIsSuccessful) {
      // get the cards using Appboy.sharedInstance()?.contentCardsController.contentCards
    }
  }
}

Braze에서 카드 데이터를 보낸 후에 변경하려면 카드 데이터의 딥 카피를 로컬에 저장하고 데이터를 업데이트한 후 직접 표시하는 것이 좋습니다. 카드는 ABKContentCardsController를 통해 접근할 수 있습니다.

콘텐츠 카드 모델

Braze는 배너, 캡션 이미지, 클래식의 세 가지 Content Cards 유형을 제공합니다. 각 유형은 기본 ABKContentCard 클래스에서 공통 속성정보를 상속받으며 다음과 같은 추가 속성정보가 있습니다.

기본 콘텐츠 카드 모델 속성정보 - ABKContentCard

등록정보 설명
idString (읽기 전용) Braze에서 설정한 카드의 ID.
viewed 이 속성정보는 사용자가 카드를 조회했는지 여부를 반영합니다.
created (읽기 전용) 이 속성정보는 Braze에서 카드 생성 시간의 Unix 타임스탬프입니다.
expiresAt (읽기 전용) 이 속성정보는 카드의 만료 시간에 대한 Unix 타임스탬프입니다.
dismissible 이 속성정보는 사용자가 카드를 해제할 수 있는지 여부를 반영합니다.
pinned 이 속성정보는 대시보드에서 카드가 “고정됨”으로 설정되었는지 여부를 반영합니다.
dismissed 이 속성정보는 사용자가 카드를 닫았는지 여부를 반영합니다.
url 카드를 클릭한 후 열리는 URL입니다. HTTP(s) URL 또는 프로토콜 URL일 수 있습니다.
openURLInWebView 이 속성정보는 URL이 앱 내에서 열릴지, 외부 웹 브라우저에서 열릴지를 결정합니다.
extras 선택적 NSDictionary(값: NSString).
등록정보 설명
image 이 속성정보는 카드 이미지의 URL입니다.
imageAspectRatio 이 속성정보는 카드 이미지의 종횡비이며 이미지 로드가 완료되기 전에 힌트로 사용됩니다. 특정 상황에서는 속성정보가 제공되지 않을 수 있습니다.

캡션 이미지 콘텐츠 카드 속성정보 - ABKCaptionedImageCard

등록정보 설명
image 이 속성정보는 카드 이미지의 URL입니다.
imageAspectRatio 이 속성정보는 카드 이미지의 종횡비입니다.
title 카드의 제목 텍스트입니다.
cardDescription 카드의 본문 텍스트입니다.
domain 속성정보 URL의 링크 텍스트, 예를 들어 @”blog.braze.com”. 카드의 UI에 표시되어 카드를 클릭할 때의 동작 및 방향을 나타낼 수 있습니다.

클래식 콘텐츠 카드 속성정보 - ABKClassicContentCard

등록정보 설명
image (선택 사항) 이 속성정보는 카드 이미지의 URL입니다.
title 카드의 제목 텍스트입니다.
cardDescription 카드의 본문 텍스트입니다.
domain 속성정보 URL의 링크 텍스트, 예를 들어 @”blog.braze.com”. 카드의 UI에 표시되어 카드를 클릭할 때의 동작 및 방향을 나타낼 수 있습니다.

카드 메서드

메서드 설명
logContentCardImpression 특정 카드에 대해 Braze에 노출 횟수를 수동으로 기록합니다.
logContentCardClicked 특정 카드에 대해 Braze에 클릭을 수동으로 기록합니다. SDK는 카드에 유효한 값이 있는 url 속성정보가 있을 때만 카드 클릭을 기록합니다.
logContentCardDismissed 특정 카드에 대해 Braze에 카드 방출을 수동으로 기록합니다. SDK는 카드의 dismissed 속성정보가 이미 true로 설정되지 않은 경우에만 카드 방출을 기록합니다.
isControlCard 카드가 A/B 테스트의 제어 카드인지 확인합니다.

자세한 내용은 클래스 참조 설명서를 참조하세요.

Content Cards 뷰 컨트롤러 통합

Content Cards는 내비게이션 또는 모달의 두 가지 뷰 컨트롤러 컨텍스트와 통합할 수 있습니다.

내비게이션 컨트롤러에 ABKContentCardsTableViewController 인스턴스를 푸시하는 예:

1
2
3
4
ABKContentCardsTableViewController *contentCards = [[ABKContentCardsTableViewController alloc] init];
contentCards.title = @"Content Cards Title";
contentCards.disableUnreadIndicator = YES;
[self.navigationController pushViewController:contentCards animated:YES];
1
2
3
4
let contentCards = ABKContentCardsTableViewController()
contentCards.title = "Content Cards Title"
contentCards.disableUnreadIndicator = true
navigationController?.pushViewController(contentCards, animated: true)

이 모달은 모달 뷰에서 뷰 컨트롤러를 표시하는 데 사용되며, 상단에 내비게이션 바가 있고 바 측면에 Done 버튼이 있습니다.

1
2
3
4
ABKContentCardsViewController *contentCards = [[ABKContentCardsViewController alloc] init];
contentCards.contentCardsViewController.title = @"Content Cards Title";
contentCards.contentCardsViewController.disableUnreadIndicator = YES;
[self.navigationController presentViewController:contentCards animated:YES completion:nil];
1
2
3
4
let contentCards = ABKContentCardsViewController()
contentCards.contentCardsViewController.title = "Content Cards Title"
contentCards.contentCardsViewController.disableUnreadIndicator = true
self.present(contentCards, animated: true, completion: nil)

뷰 컨트롤러 예제를 보려면 Content Cards 샘플 앱을 확인하세요.

New Stuff!