# How to Configure iOS Push Notifications

> \[!CAUTION]
>
> Twilio deprecated Notify in October 2022 and no longer supports it. Learn more about [transitioning off Notify](https://support.twilio.com/hc/en-us/articles/11746930233115-Transitioning-off-Notify).
>
> If you're starting a new project, use [Programmable Messaging](/docs/messaging) for SMS notifications. For push notifications, integrate directly with platform-specific services such as APNs for iOS or FCM for Android. If you've already built on Notify, visit the [transition guide](https://support.twilio.com/hc/en-us/articles/11746930233115-Transitioning-off-Notify) to learn about your options.

In this guide, we'll go through all the necessary steps to get your Apple push credentials configured for Twilio Notifications. The end result is a Twilio Credential which you can then use to receive notifications in your iOS app. Let's get started!

These are the steps you'll take:

1. [Set up an App ID](#1-set-up-an-app-id)
2. [Create a certificate](#2-create-a-certificate)
3. [Create a credential SID for Twilio](#3-create-a-credential-for-twilio)
4. [Configure your Twilio Service to use your APNS credentials](#4-configure-your-twilio-service-to-use-your-apns-credentials)

## 1. Set up an App ID

Log into your [Apple development account](https://developer.apple.com/account) and click on **Identifiers** under the **Certificates, Identifiers & Profiles** section. This will show a list of identifiers, including App IDs.

### Option 1 — Use an existing App ID

If your App ID is already on this list, click on it, and a list of capabilities will pop up.

1. Check the **Push Notifications** option.
2. Don't worry about the **Configure** button right now, just click the **Save** button in the upper right of the page.

### Option 2 — Create a new App ID

If your App ID isn't on this list, click the **+** symbol to add a new App ID.

1. Choose **App IDs** and click the **Continue** button in the upper right of the page.
2. Give your app a description.
3. Enter an Explicit Bundle ID that matches the bundle identifier (such as `com.twilio.notify.NotifyQuickstart`) of your app in Xcode.
4. Under **Capabilities** check **Push Notifications**.
5. Click the **Continue** button.
6. Click the **Register**button to confirm your new App ID and create it.

## 2. Create a certificate

Now you'll need to create a push notification certificate. This will enable your app to receive notifications. You can either make a development certificate or a production certificate. For this guide, we'll make a development certificate. We recommend you use Xcode managed certificate.

### Option 1 — Use an Xcode managed certificate

1. In your Xcode project, go to the **General** pane of the target for your iOS application:

   ![general tab Xcode.](https://docs-resources.prod.twilio.com/a01a25357fdecf624db6251e1077754252936e881b2724e9cf0652a85c989daa.gif)
2. In the **Signing** section, check **Automatically manage signing**:

   ![Automatic signing with Xcode.](https://docs-resources.prod.twilio.com/d1faaa2afcc74040d1ee8205abba9480b8969a9066efcf8e21d495b3935bed87.png)
3. If you are using the Quickstart app and see a provisioning error message, you may need to rename the bundle ID to a unique identifier:

   ![Bundle identifier error.](https://docs-resources.prod.twilio.com/f2d73e6db94c65187f7ec01054f9f567475d8a064236898c22f44ba2cd677189.png)

   To do so, go to [https://developer.apple.com/account/resources/certificates/list](https://developer.apple.com/account/resources/certificates/list) and give the bundle a new name. Then, enter your new identifier in the **Identity** section of the **General** pane:

   ![Unique bundle identifier.](https://docs-resources.prod.twilio.com/02a4d9bd470c4522eff69c2ed05a85c8285e157133189cdaf32e52660c361eda.png)
4. Go to the **Capabilities** tab and make sure that Push Notifications are enabled:

   ![Enable push notifications.](https://docs-resources.prod.twilio.com/55e15bd363e3fd655a2b6ee6bf0b3a772a0495e75adaf922df7221d3aed7d602.png)
5. You can verify that your certificates have been created in a few different ways. For more information on Apple Certificates, click this [link](https://developer.apple.com/support/certificates/).

   1. Via the Apple developer portal:

      1. Sign in to [the Apple developer portal](https://developer.apple.com/account) and click on **Certificates, IDs & Profile**.
      2. In the **Certificates** section at the top, select **Development** or **Production** depending on the type of certificate you want to verify.
   2. Make sure your certificate is stored in your keychain:

      1. On your Mac, go to **Applications > Utilities > Keychain Access** and select **Certificates** at the top. Search for `iPhone` to filter for iPhone certificates.
      2. Double-check that your certificate has a disclosure triangle next to it. This indicates the existence of your private key in the keychain.
6. Congratulations! You just created an Apple Development iOS Push Services certificate. If you run into problems during this process, please see [this guide from Apple](https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/MaintainingCertificates/MaintainingCertificates.html).

### Option 2 — Manually create a certificate

While we recommend you use Xcode managed certificates for your application, you may prefer to create your certificate manually.

1. Add a certificate on the [Apple Developer Portal](https://developer.apple.com/account/resources/certificates/add).
2. Under **Services**, select **Apple Push Notification service SSL (Sandbox & Production)**.
3. Click **Continue**.
4. In the text box, select the App ID you created previously.
5. Click **Continue** again.
6. You will be prompted to create a Certificate Signing Request (CSR), and given instructions on how to do it. Create one.
7. Once you've created a CSR, click **Continue**.
8. Upload it.
9. Click **Generate** to generate your certificate.

Well done! You just created an Apple Development iOS Push Services certificate. Now you can download it and double-click on it to add it to your Mac's keychain.

## 3. Create a credential for Twilio

On your Mac, open **Applications > Utilities > Keychain Access**, and go to the **My Certificates** Category at the top.

1. Right-click your new certificate. It should be labeled `Apple Development iOS Push Services`.
2. Choose **Export**.
3. Save it as `cred.p12` — make sure you leave the password blank.

This is your credential file. You will extract your certificate key and private key from this file — you need these two keys to create a Twilio credential. First, run this command in Terminal:

```bash
openssl pkcs12 -in cred.p12 -nokeys -out cert.pem -nodes
```

`cert.pem` is your certificate key file. Now run the following command in Terminal:

```bash
openssl pkcs12 -in cred.p12 -nocerts -out key.pem -nodes
```

`key.pem` is your private key file. Now run this command to process this key:

```bash
openssl rsa -in key.pem -out key.pem
```

You can now paste your credentials into the modal found in the [Twilio Console](/console/notify/credentials) to upload them.

Make sure that you strip anything **outside** of the `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----` boundaries and outside of the `-----BEGIN RSA PRIVATE KEY-----` and `-----END RSA PRIVATE KEY-----` boundaries before pasting your credentials. Check the **Sandbox** button if you made a development certificate. Sandbox is synonymous with development mode:

![Create APNS Credentials.](https://docs-resources.prod.twilio.com/54b389932112e2b95dbe9c2fee17084797de901fd90cf959f8b5aa0ce208acc9.png)

> \[!WARNING]
>
> Once a Credential is saved, `CERTIFICATE` and `PRIVATE KEY` fields will be hidden for security reasons.

After you've pasted them in, click **Save**. If everything went well, you'll see an SID appear on the new page. Copy it to your clipboard — you will need it in the next step.

Congratulations, you just made a Twilio Push Credential!

## 4. Configure your Twilio Service to use your APNS credentials

Twilio allows you to build multiple applications within a single account. To separate those applications, you need to create Service instances that hold all the data and configuration for a given application.

Specifically, you need to configure your Service instance to use the Credential that contains your APNS certificate and private key. You can do that using the [Services](/console/notify/services) page in the Console. You'll need to update your Service with the Twilio Push Credential SID:

![Configure page with dropdown options for APN Credential SID, listing Twilio Quickstart choices, and setup links on the side.](https://docs-resources.prod.twilio.com/63cafb27bae2cb4f5cc53e1cd0fb36a090711c3276d3ab954b3ae552c43509c6.jpg)

If you are just getting started, set up this APN credential first, then create your Service by clicking the blue plus button on the **Services** [Console page](https://console.twilio.com/us1/develop/notify/services?frameUrl=%2Fconsole%2Fnotify%2Fservices%3Fx-target-region%3Dus1).

You are ready to go. You can now check out the [iOS Quickstart](/docs/notify/quickstart/ios) to start sending notifications.
