このページはAIにより自動翻訳されており、不正確な内容が含まれている可能性があります。翻訳の誤りを報告するには、ページ右側の目次の下にあるフィードバックをご利用ください。

警告
AppboyKit(Objective-C SDKとも呼ばれます)はもはやサポートされておらず、Swift SDK. 新しい機能、バグ修正、セキュリティー更新s、またはテクニカルサポートを受けません。ただし、メッセージングと分析は通常どおり機能し続けます。詳しくは、新しいBrazeの概要SDK]を参照してください。
コンテンツカード統合
コンテンツカードデータモデル
コンテンツカードデータモデルはiOS SDKで使用できます。
データを取得する
コンテンツカードデータモデルにアクセスするには、コンテンツカード更新イベントを購読してください。
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には、バナー、キャプション付き画像、クラシックの3種類のContent Cardsが用意されています。各タイプはベースABKContentCardクラスから共通のプロパティを継承し、以下の追加プロパティを持ちます。
ベースコンテンツカードモデルプロパティ - ABKContentCard
| プロパティ |
説明 |
idString |
(読み取り専用) Brazeで設定されたカードのID。 |
viewed |
このプロパティは、ユーザーがカードを閲覧したかどうかを反映します。 |
created |
(読み取り専用) このプロパティは、Brazeからのカードの作成時刻のUNIXタイムスタンプです。 |
expiresAt |
(読み取り専用) このプロパティは、カードの有効期限のUNIXタイムスタンプです。 |
dismissible |
このプロパティは、ユーザーがカードを非表示にできるかどうかを反映します。 |
pinned |
このプロパティは、カードがダッシュボードで「ピン留め」されているかどうかを反映します。 |
dismissed |
このプロパティは、ユーザーがカードを非表示にしたかどうかを反映します。 |
url |
カードをクリックした後に開かれるURL。HTTP(S) URLでもプロトコルURLでもかまいません。 |
openURLInWebView |
このプロパティは、URLをアプリ内で開くか、外部Webブラウザーで開くかを決定します。 |
extras |
NSString値のオプションのNSDictionary。 |
バナーコンテンツカードのプロパティ - ABKBannerContentCard
| プロパティ |
説明 |
image |
このプロパティはカードの画像のURLです。 |
imageAspectRatio |
このプロパティはカードの画像の縦横比であり、画像の読み込みが完了する前のヒントとして機能します。ただし、場合によってはプロパティが提供されないことがあります。 |
キャプション付き画像コンテンツカードのプロパティ - ABKCaptionedImageCard
| プロパティ |
説明 |
image |
このプロパティはカードの画像のURLです。 |
imageAspectRatio |
このプロパティはカードの画像の縦横比です。 |
title |
カードのタイトルテキスト。 |
cardDescription |
カードの本文テキスト。 |
domain |
@”blog.braze.com” のようなプロパティURLのリンクテキスト。カードのUIに表示して、カードをクリックしたときのアクション/方向を示すことができます。 |
クラシックコンテンツカードのプロパティ - ABKClassicContentCard
| プロパティ |
説明 |
image |
(オプション) このプロパティはカードの画像のURLです。 |
title |
カードのタイトルテキスト。 |
cardDescription |
カードの本文テキスト。 |
domain |
@”blog.braze.com” のようなプロパティURLのリンクテキスト。カードのUIに表示して、カードをクリックしたときのアクションと方向を示すことができます。 |
カードメソッド
| メソッド |
説明 |
logContentCardImpression |
特定のカードのインプレッションを手動でBrazeに記録します。 |
logContentCardClicked |
特定のカードのクリックを手動でBrazeに記録します。SDKは、カードに有効な値のurlプロパティがある場合にのみカードクリックを記録します。 |
logContentCardDismissed |
特定のカードの非表示を手動でBrazeに記録します。カードのdismissedプロパティがまだtrueに設定されていない場合にのみ、SDKはカードの非表示を記録します。 |
isControlCard |
カードがA/Bテストのコントロールカードであるかどうかを判断します。 |
詳細については、クラスリファレンスドキュメントを参照してください。
コンテンツカードビューコントローラーの統合
コンテンツカードは、ナビゲーションまたはモーダルという2つのビューコントローラーコンテキストで統合できます。
ナビゲーションコンテキスト
ナビゲーションコントローラーに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)
|

注
ナビゲーションバーのタイトルをカスタマイズするには、ABKContentCardsTableViewControllerインスタンスのnavigationItemのタイトルプロパティを設定します。
モーダルコンテキスト
このモーダルは、ビューコントローラーをモーダルビューに表示するために使用され、上部にナビゲーションバー、バーの横に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サンプルアプリをご覧ください。

注
ヘッダーをカスタマイズするには、親ABKContentCardsViewControllerインスタンスに埋め込まれているABKContentCardsTableViewControllerインスタンスに属するnavigationItemのタイトルプロパティを設定します。