> ## Documentation Index
> Fetch the complete documentation index at: https://docs.suprsend.com/llms.txt
> Use this file to discover all available pages before exploring further.

# iOS Push

> Guide to setup APNS iOS Push configuration in SuprSend.

## Add APNs configuration on SuprSend dashboard

On the SuprSend dashboard, go to vendor page from side panel, select iOSpush and fill in below details. You'll get all these information from [Apple developer account](https://developer.apple.com/account/)

<Frame>
  <img src="https://mintcdn.com/suprsend/ysJyO3LOXwZ5L098/images/docs/f8409f2-APNs_vendor_page.png?fit=max&auto=format&n=ysJyO3LOXwZ5L098&q=85&s=b10b6dbf98a3b9df0be32640528a2f53" width="2512" height="1540" data-path="images/docs/f8409f2-APNs_vendor_page.png" />
</Frame>

| Form Field       | Description                                                                                                                                                                                                                                                                                                       |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Nickname         | You can give any name which may help you to identify this account easily                                                                                                                                                                                                                                          |
| Mode/Environment | Select **Production** if you're testing the app via TestFlight or running the live App Store build. Select **Development** if you're testing the app locally through Xcode (debug build on a connected device or simulator). The mode here must match the build type you're testing with - see the warning below. |
| Upload p8 file   | You'll get .p8 key file from your apple developer account. Refer [section below](/docs/ios-push-vendor-integration#generating-p8-key-file-and-auth-key-id) to see how to generate .p8 file                                                                                                                        |
| Auth Key ID      | Auth key ID is a part of the filename of your .p8 file. Refer [section below](/docs/ios-push-vendor-integration#generating-p8-key-file-and-auth-key-id) to see how to get Auth key ID                                                                                                                             |
| Team ID          | You'll get Team ID from your apple developer account. Refer [section below ](/docs/ios-push-vendor-integration#how-to-get-team-id)to see how to get Team ID                                                                                                                                                       |
| Bundle ID        | Bundle ID is a unique identifier of your app. SuprSend will require this key to identify your app for sending push notification.[Refer section](/docs/ios-push-vendor-integration#how-to-get-bundle-id) to see how to get Bundle ID                                                                               |

<Warning>
  **Mode/Environment must match your build type.** This is the most common reason iOS pushes fail to deliver. If the mode doesn't match the build, APNs rejects the push with a `BadDeviceToken` error (visible in SuprSend logs as the delivery failure reason) because sandbox and production tokens are issued by different APNs endpoints and aren't interchangeable.

  * Set **Production** when testing on **TestFlight** builds or the live **App Store** build (these use production APNs tokens).
  * Set **Development** when testing locally through **Xcode** - i.e., a debug build run on a physical device or simulator (these use sandbox APNs tokens).

  If you flip these by mistake (e.g., Production mode while debugging in Xcode, or Development mode on a TestFlight build), the device will register a token but every push will fail with `BadDeviceToken`. To fix it, switch the vendor mode to match the build you're testing.
</Warning>

### Generate .p8 key file and Auth key ID

<Steps>
  <Step title="To generate a .p8 key file, login to your Apple developer account page">
    To generate a `.p8 key` file, login to your [Apple developer account](https://developer.apple.com/account/) page, then select **Certificates, IDs & Profiles**.

    <Frame>
      <img src="https://mintcdn.com/suprsend/jhGzZpggWCp1KSgu/images/docs/db8afde-Frame_57_1.png?fit=max&auto=format&n=jhGzZpggWCp1KSgu&q=85&s=7ce06c7d82018176b0e2aa0c6fdc4a77" width="596" height="700" data-path="images/docs/db8afde-Frame_57_1.png" />
    </Frame>
  </Step>

  <Step title="Select `Keys`">
    Under Certificates, IDs & Profiles section, select **"Keys"**

    <Frame>
      <img src="https://mintcdn.com/suprsend/iZJ8XgyTL4NrLVtX/images/docs/aa8b860-image.png?fit=max&auto=format&n=iZJ8XgyTL4NrLVtX&q=85&s=34df96c83681e04b318d21fb34ce69ec" width="656" height="810" data-path="images/docs/aa8b860-image.png" />
    </Frame>
  </Step>

  <Step title="Add a new key">
    Click on "`+`" button next to keys to add a new key

    <Frame>
      <img src="https://mintcdn.com/suprsend/ftswjUsq0JlUh-RL/images/docs/00113e9-image.png?fit=max&auto=format&n=ftswjUsq0JlUh-RL&q=85&s=23029b200ac22aaeeb11501ac112d322" width="566" height="221" data-path="images/docs/00113e9-image.png" />
    </Frame>
  </Step>

  <Step title="Type in your key name and check the Apple Push Notification service">
    On the new key page, type in your key name and check the Apple Push Notification service (APNs) box, then click “Continue” and “Register".

    <Frame>
      <img src="https://mintcdn.com/suprsend/y77gmHjmaTSnbCzd/images/docs/c1c2f64-image.png?fit=max&auto=format&n=y77gmHjmaTSnbCzd&q=85&s=b153d5e5a6d6ac32c8098d61c7a94afa" width="847" height="379" data-path="images/docs/c1c2f64-image.png" />
    </Frame>
  </Step>

  <Step title="Download the p8 key file">
    Once the key is generated, **`download the p8 key`** file by clicking on "`Download`"

    <Frame>
      <img src="https://mintcdn.com/suprsend/09Y8zJBSaqwwb23r/images/docs/65f5a48-Frame_58.png?fit=max&auto=format&n=09Y8zJBSaqwwb23r&q=85&s=4b0be7b0a53a9dfe9de2b034686237bb" width="781" height="301" data-path="images/docs/65f5a48-Frame_58.png" />
    </Frame>
  </Step>
</Steps>

The Auth Key filename will look like this: `**AuthKeyABCD1234.p8**`, the `**ABCD1234**` is the Key ID for this key, add this key ID in Auth key ID field on Vendor configuration page

### How to get team ID

You can get team ID from your [Apple developer account membership page](https://developer.apple.com/account/#/membership)

<Frame>
  <img src="https://mintcdn.com/suprsend/jhGzZpggWCp1KSgu/images/docs/d2d176d-Frame_59.png?fit=max&auto=format&n=jhGzZpggWCp1KSgu&q=85&s=3a1d998eadc3980ea5b8450dc78f6627" width="735" height="432" data-path="images/docs/d2d176d-Frame_59.png" />
</Frame>

### How to get bundle ID

You can get this ID from your app project

<Frame>
  <img src="https://mintcdn.com/suprsend/jhGzZpggWCp1KSgu/images/docs/e5f785b-Frame_60.png?fit=max&auto=format&n=jhGzZpggWCp1KSgu&q=85&s=3821f637362ed90a038c571f009ee683" width="1341" height="649" data-path="images/docs/e5f785b-Frame_60.png" />
</Frame>

***
