> 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/developer-guide/sdk-configuration/ios.md).

# iOS

The Push Provisioning SDK supports iOS for Apple Pay push provisioning.

### Prerequisites <a href="#prerequisites" id="prerequisites"></a>

* iOS 13.0+
* Xcode 14.0+
* Swift 5.0+

> <i class="fa-info-circle">:info-circle:</i>
>
> * For full Apple Pay functionality, run on physical devices.
> * Do production testing in the Production Environment on production devices, using Ad Hoc provisioning profiles, TestFlight, or the App Store. Do Pre-Production testing from Xcode.

### Push Provisioning Access <a href="#push-provisioning-access" id="push-provisioning-access"></a>

Apple Pay push provisioning requires a special Apple entitlement named **com.apple.developer.payment-pass-provisioning**. Request it by emailing [iap\_entitlements@apple.com](mailto:apple-pay-provisioning@apple.com).

In your email, include the following information:

* Your app name.
* Your Developer Team ID, available in [Apple Developer Membership](https://developer.apple.com/account/#/membership).
* ADAM ID (your app's unique numeric ID), found in App Store Connect or in the App Store linked to your app, for example, <https://apps.apple.com/app/id123456789>.

Once Apple grants the entitlement, add the distribution entitlement to a provisioning profile. Use the same profile to develop the app in Xcode.

In your project, open or create the entitlements file. Add the **com.apple.developer.payment-pass-provisioning** key with a Boolean value `YES`.

Then, in your app target, go to **Build Settings > Signing > Code Signing Entitlements**. Ensure it points to the entitlements file.

```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>
```

Also add the `In-App Provisioning` capability in the app configuration:

<figure><img src="/files/7GuXuvlqQgYgI4TBs3dj" alt=""><figcaption><p>Add the In-App Provisioning capability.</p></figcaption></figure>

For more details about how to set up Apple Pay, see [Setting Up Apple Pay](https://developer.apple.com/documentation/passkit/apple_pay/setting_up_apple_pay).

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

1. Download the latest release of Push Provisioning SDK and extract the ZIP file.
2. Go to the Xcode project folder, and create a new folder "TPCSDK".
3. Put the extracted `TPCSDKSwift.xcframework` in the folder.
4. In the app target, select **General > Frameworks, Libraries, and Embedded Content, click + > Add Other > click Add Files**.
5. Select the `TPCSDKSwift.xcframework` and click **Open**.

<figure><img src="/files/CX4yEG9bqcvfnJkszCD5" alt=""><figcaption><p>Add the XCFramework to your app target.</p></figcaption></figure>

Ensure that `Embed & Sign` is selected as follows:

<figure><img src="/files/6YBPpsXTTeU2dZnb6xt8" alt=""><figcaption><p>Set the framework to Embed &#x26; Sign.</p></figcaption></figure>

If you use an Objective-C project, set `Framework Search Paths` and `Header Search Paths`.

<figure><img src="/files/tugrrkCDn59hVUc7pmDj" alt=""><figcaption><p>Set Framework Search Paths.</p></figcaption></figure>

<figure><img src="/files/7mSI60rlwRFZjj6UJ9LF" alt=""><figcaption><p>Set Header Search Paths.</p></figcaption></figure>

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

### Configuration <a href="#configuration" id="configuration"></a>

Add the following configuration to your application to use the Push Provisioning SDK.

Import the `TPCSDKSwift` module in your `AppDelegate.swift`:

```swift
import TPCSDKSwift
```

{% endtab %}

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

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

#### Import a header into the project <a href="#import-a-header-to-the-project" id="import-a-header-to-the-project"></a>

1. Create a `Bridging-Header.h` file by creating a Swift file.
2. Import the TPCSDKSwift header file in `Bridging-Header.h`.

#### Add the configuration code to your application <a href="#add-the-configuration-code-to-your-application" id="add-the-configuration-code-to-your-application"></a>

Import the TPCSDKSwift module in your `AppDelegate`:

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

To enable Swift framework support, ensure that the following project definitions exist:

```
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>
>
> #### Note <a href="#note" id="note"></a>
>
> Due to a bug in Xcode, you must create at least one Swift file (it can be empty) in the project. Include it in **Build Phases > Compile Sources**.

Configure the Push Provisioning SDK in your `application:didFinishLaunchingWithOptions:` delegate function.

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

```swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.
 
    let tpcIssuerId = "TPC_ISSUER"
    do {
      try TPCSDK.configure(variant: .PPROD,
                          issuerId: tpcIssuerId)
      // Apple Pay and provisioning is supported
    } catch {
      // Handle TPCError
    } 
    
    return true
  }
```

{% endtab %}

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

```objective-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  // Override point for customization after application launch.
  NSError *error = nil;
  [TPCSDK configureWithVariant:SdkVariantPROD issuerId:@"TPC_ISSUER" error:&error];
  if (error) {
      NSLog(@"Handle TPCError");
  }
  
  return YES;
}
```

{% endtab %}
{% endtabs %}

> <i class="fa-exclamation-circle">:exclamation-circle:</i>
>
> #### Note <a href="#note-1" id="note-1"></a>
>
> All PKPassLibrary operations (isCardDigitized, getCardDigitizationResult, activatePass, ...) are not thread-safe. Run them on a single thread. <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/developer-guide/sdk-configuration/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.
