> For the complete documentation index, see [llms.txt](https://documentation.pushly.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.pushly.com/pushly-ja/integration/implementation-steps/apple-ios/sdk-swift-obj-c/app-messages.md).

# App Messages

App Messagesは、Push NotificationsやLive Activitiesとは異なり、サブスクリプショントークンを必要とせずにユーザー基盤と対話し、エンゲージすることを可能にします。App Messageは、プログラムで提供できるカスタム条件を含む複数の基準に基づいて、自動的に表示するよう設定できます。

カスタム条件を使用したApp Messagesでは、PushSDKが、これらの条件が満たされたことを通知するための便利なメソッドや、特定のライフサイクルイベントを監視する機能を提供します。

## 前提条件

SDKとApp Messagesを統合する前に、以下の要件を満たす必要があります:

* iOSアプリ
* iOS 11.0以降がインストールされたデバイスまたはエミュレーター
* App MessagesをサポートするPushSDKリリース（以下のバージョン対応表を参照）

## ステップ1: iOS SDKのセットアップ

アプリケーションが **まだ** PushSDKを使用していない場合は、ネイティブアプリのPushセットアップガイドを参照してください。 [Apple / iOS](/pushly-ja/integration/implementation-steps/apple-ios.md).

すでにPushSDKを使用しているアプリケーションでは、App Messageサポートを含む後続のバージョンへアップグレードする必要がある場合があります。以下の表を使用して、インストールのアップグレードが必要かどうかを確認してください。

<table><thead><tr><th width="191">SDK</th><th>App Messagesを含む最初のバージョン</th></tr></thead><tbody><tr><td><a href="/pages/39b0cf329f28c0d2050f4731161d426692ed693d">Objective-C / Swift</a></td><td>1.3.0+</td></tr><tr><td><a href="/pages/7da103785af19cf2dddb0f0bdc52093ebca8d247">React Native SDK</a></td><td>1.2.0+</td></tr><tr><td><a href="/pages/342db951b1a038ed6a5bc35dc35fa015cae6d146">Flutter SDK</a></td><td>1.2.0+</td></tr></tbody></table>

{% tabs %}
{% tab title="Swift Package Manager" %}
Xcodeのプロジェクトナビゲーターパネル内で `Package Dependencies`を見つけて右クリックし、 `Pushly` を選択します。 `Update Package`.

<figure><img src="/files/1cbf6eef8069de48fcea6d6a0d285d494c812ba6" alt=""><figcaption></figcaption></figure>

更新後にパッケージが 1.3.0 以上でない場合は、プロジェクトナビゲータでプロジェクトを選択し、プロジェクトを選択してから、次へ移動します `Package Dependencies`。次を選択します `Pushly` に移動し、 `Dependency Rule` が `Up to Next Major Version` を、1.3.0以上を対象として。

<figure><img src="/files/7c5ee0fa90616cec3af31f9d56929d09159c30c7" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="CocoaPods" %}

* 次を対象にしていることを確認してください `'Pushly', '>= 1.3', '< 2.0'` をPodfileに記載してください。
* 実行 `pod update Pushly`
* Podfile.lockを確認して、最新バージョンがダウンロードされていることを確認してください。
  {% endtab %}
  {% endtabs %}

## ステップ2: App Messageを作成してスケジュールする

Pushly Platformを使用して、最初の [App Message](/pushly-ja/platform/app-messages.md).

## ステップ3:（任意）App Messageのカスタム条件をトリガーする

カスタム条件を使用する場合、PushSDKを使ってこれらの条件をプログラムで提供し、その後、現在アクティブで、提供された条件に一致するApp Messagesを評価する処理がトリガーされます。

多くの場合、1つの条件を一度にトリガーして評価します。このような場合は、 `trigger(condition: String, withValue: String)` メソッドシグネチャを使用します。

{% tabs %}
{% tab title="Swift" %}
{% code fullWidth="false" %}

```swift
PushSDK.AppMessages.trigger(condition: "enabled_subscription", withValue: "true")
```

{% endcode %}
{% endtab %}

{% tab title="Objective-C" %}

```objectivec
[PushSDKAppMessages triggerCondition:@"enabled_subscription" withValue:@"true"];
```

{% endtab %}
{% endtabs %}

ただし、評価のために複数の条件を一度にトリガーする方が便利な場合もあります。このような場合は、任意の数の条件を含むディクショナリを次のメソッドに渡すことができます `trigger(conditions: [String : String])` メソッドシグネチャを使用します。

{% tabs %}
{% tab title="Swift" %}
{% code fullWidth="false" %}

```swift
PushSDK.AppMessages.trigger(conditions: [
    "enabled_subscription": "true",
    "subscriber_tier": "premium"
])
```

{% endcode %}
{% endtab %}

{% tab title="Objective-C" %}

```objectivec
[PushSDKAppMessages triggerConditions:@{
    @"enabled_subscription" : @"true",
    @"subscriber_tier": @"premium"
}];
```

{% endtab %}
{% endtabs %}

## ステップ4:（任意）App Messageのライフサイクルイベントを監視する

こちらの [SDK Delegates](/pushly-ja/integration/implementation-steps/apple-ios/sdk-swift-obj-c/sdkderigto.md#app-message-lifecycle-delegates) ドキュメントを参照して、App Messagesのライフサイクルイベントの処理方法について確認してください。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.pushly.com/pushly-ja/integration/implementation-steps/apple-ios/sdk-swift-obj-c/app-messages.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
