> For the complete documentation index, see [llms.txt](https://docs.payments.thalescloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payments.thalescloud.io/classic-push-provisioning/ja/gaido/sdkno/ios.md).

# iOS

Push Provisioning SDK は、Apple Pay のプッシュプロビジョニング向けに iOS をサポートしています。

### 前提条件 <a href="#prerequisites" id="prerequisites"></a>

* iOS 13.0 以降
* Xcode 14.0 以降
* Swift 5.0 以降

> <i class="fa-info-circle">:info-circle:</i>
>
> * Apple Pay のすべての機能を利用するには、実機で実行してください。
> * 本番テストは、本番デバイスの本番環境で、Ad Hoc プロビジョニングプロファイル、TestFlight、または App Store を使用して実施します。プレプロダクションテストは Xcode から実施します。

### プッシュプロビジョニングへのアクセス <a href="#push-provisioning-access" id="push-provisioning-access"></a>

Apple Pay のプッシュプロビジョニングには、次の特別な Apple エンタイトルメントが必要です **com.apple.developer.payment-pass-provisioning**。リクエストするには、次の宛先にメールを送信してください [iap\_entitlements@apple.com](mailto:apple-pay-provisioning@apple.com).

メールには、次の情報を含めてください：

* アプリ名。
* Apple Developer Membership で確認できる、あなたの Developer Team ID。 [Apple Developer Membership](https://developer.apple.com/account/#/membership).
* ADAM ID（アプリの一意の数値 ID）。App Store Connect またはアプリにリンクされた App Store で確認できます。たとえば、 <https://apps.apple.com/app/id123456789>.

Apple がエンタイトルメントを付与したら、配布用エンタイトルメントをプロビジョニングプロファイルに追加します。Xcode でアプリを開発する際は、同じプロファイルを使用してください。

プロジェクトでエンタイトルメントファイルを開くか作成し、 **com.apple.developer.payment-pass-provisioning** キーに Boolean 値 `YES`.

を追加します。次に、アプリターゲットで、 **ビルド設定 > 署名 > コード署名エンタイトルメント**へ移動し、それがエンタイトルメントファイルを指していることを確認します。

```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>com.apple.developer.payment-pass-provisioning</key>
    <true/>
  </dict>
</plist>
```

また、 `アプリ内プロビジョニング` 機能をアプリ設定に追加します：

<figure><img src="/files/cd88ed6bd6f5e92594031a4caca6ab89946df4d4" alt=""><figcaption><p>アプリ内プロビジョニング機能を追加します。</p></figcaption></figure>

Apple Pay の設定方法の詳細については、次を参照してください [Apple Pay の設定](https://developer.apple.com/documentation/passkit/apple_pay/setting_up_apple_pay).

### Push Provisioning SDK の統合 <a href="#integrating-push-provisioning-sdk" id="integrating-push-provisioning-sdk"></a>

1. Push Provisioning SDK の最新リリースをダウンロードし、ZIP ファイルを展開します。
2. Xcode プロジェクトフォルダに移動し、新しいフォルダ「TPCSDK」を作成します。
3. 展開した `TPCSDKSwift.xcframework` をそのフォルダに配置します。
4. アプリターゲットで、 **一般 > フレームワーク、ライブラリ、埋め込みコンテンツ に移動し、+ > その他を追加 > ファイルを追加をクリックします**.
5. 次を選択し、 `TPCSDKSwift.xcframework` をクリックして **開く**.

<figure><img src="/files/42ae01d997b61cd3d8608be908aff6c6ea82ab9a" alt=""><figcaption><p>XCFramework をアプリのターゲットに追加します。</p></figcaption></figure>

〜であることを確認してください `埋め込みと署名` 次のように選択されていることを確認してください:

<figure><img src="/files/2498279deee1b6b0dc9936102784e0c70b182219" alt=""><figcaption><p>フレームワークを［埋め込みと署名］に設定します。</p></figcaption></figure>

Objective-C プロジェクトを使用している場合は、 `フレームワーク検索パス` および `ヘッダー検索パス`.

<figure><img src="/files/09e3662d871bfb3eb7575e91878ec5ce9683ad7c" alt=""><figcaption><p>フレームワーク検索パスを設定します。</p></figcaption></figure>

<figure><img src="/files/f9020585496cfc3b1613b39f7c724c000d34229d" alt=""><figcaption><p>ヘッダー検索パスを設定します。</p></figcaption></figure>

{% tabs %}
{% tab title="Swift" %}

### 構成 <a href="#configuration" id="configuration"></a>

Push Provisioning SDK を使用するには、次の構成をアプリケーションに追加してください。

をインポートする `TPCSDKSwift` あなたのモジュール内の `AppDelegate.swift`:

```swift
TPCSDKSwift をインポート
```

{% endtab %}

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

### 構成 <a href="#configuration-1" id="configuration-1"></a>

#### プロジェクトにヘッダーをインポートする <a href="#import-a-header-to-the-project" id="import-a-header-to-the-project"></a>

1. 作成する `Bridging-Header.h` Swiftファイルを作成してファイルを作成します。
2. TPCSDKSwiftヘッダーファイルをインポートする `Bridging-Header.h`.

#### 構成コードをアプリケーションに追加する <a href="#add-the-configuration-code-to-your-application" id="add-the-configuration-code-to-your-application"></a>

TPCSDKSwiftモジュールをあなたの `AppDelegate`:

```objective-c
#import <TPCSDKSwift-Swift.h>
```

Swiftフレームワークのサポートを有効にするには、次のプロジェクト定義が存在することを確認してください:

```
SWIFT_OBJC_BRIDGING_HEADER=Project/Project-Bridging-Header.h

SWIFT_VERSION=5.0

ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=YES
```

{% endtab %}
{% endtabs %}

> <i class="fa-info-circle">:info-circle:</i>
>
> #### 注意 <a href="#note" id="note"></a>
>
> Xcode のバグにより、プロジェクト内に少なくとも 1 つの Swift ファイル（空でも可）を作成する必要があります。これを **Build Phases > Compile Sources**.

Push Provisioning SDK をあなたの `application:didFinishLaunchingWithOptions:` デリゲート関数。

{% tabs %}
{% tab title="Swift" %}

```swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // アプリケーション起動後のカスタマイズ用のオーバーライドポイント。
 
    let tpcイシュアId = "TPC_ISSUER"
    do {
      try TPCSDK.configure(variant: .PPROD,
                          発行者ID: tpcIssuerId)
      // Apple Pay とプロビジョニングがサポートされています
    } catch {
      // TPCErrorを処理
    } 
    
    true を返す
  }
```

{% endtab %}

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

```objective-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  // アプリケーション起動後のカスタマイズ用のオーバーライドポイント。
  NSError *error = nil;
  [TPCSDK configureWithVariant:SdkVariantPROD issuerId:@"TPC_ISSUER" error:&error];
  if (error) {
      NSLog(@"TPCError を処理");
  }
  
  YESを返す;
}
```

{% endtab %}
{% endtabs %}

> <i class="fa-exclamation-circle">:exclamation-circle:</i>
>
> #### 注意 <a href="#note-1" id="note-1"></a>
>
> PKPassLibrary のすべての操作（isCardDigitized、getCardDigitizationResult、activatePass、...）はスレッドセーフではありません。単一のスレッドで実行してください。 <https://developer.apple.com/documentation/passkit/pkpasslibrary>


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.payments.thalescloud.io/classic-push-provisioning/ja/gaido/sdkno/ios.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
