# iOS Production Setup

Follow these steps to get Native Notify push notifications working in iOS production mode.

> **Required:**
>
> You must follow the [Start Here](/docs/setup/installation) instructions BEFORE
> you set up iOS production push notifications. iOS production push
> notifications will not work without first following the [Start
> Here](/docs/setup/installation) instructions.

## Setup

1. **Run eas build**

   Run this command in your Expo project terminal:

   ```bash
   eas build
   ```

2. **Select a platform**

   Select platform "iOS".

3. **Select a distribution certificate**

   Answer "Yes" to the "Reuse this distribution certificate?" question, or answer "Yes" to let EAS create a new one for you if you do not already have a distribution certificate.

   > **Note:**
   >
   > You can reuse distribution certificates for multiple apps.

4. **Select Apple provisioning profile**

   Answer "Yes" to the "Generate a new Apple Provisioning Profile?" question.

5. **Setup push notifications**

   Answer "Yes" to the "Would you like to set up Push Notifications for your
   project?" question.

6. **Setup push key**

   Answer "Yes" to the "Reuse this Push Key?" question, or answer "Yes" to let EAS create a new one if you do not already have a push key.

   > **Note:**
   >
   > You can reuse push keys for multiple apps.

7. **Publish your app**

   Once your iOS build is complete, run this command in your terminal to publish your iOS app to the Apple App Store:

   ```bash
   eas submit --platform ios
   ```

## Send yourself a push notification

Congratulations! You can now send yourself a push notifications in iOS production mode. You can test iOS push notifications by installing your new app in TestFlight and sending yourself a push notification.

You can send a push notification to yourself using the Send Push Notification Form in your [NativeNotify.com](https://app.nativenotify.com/sign-up-one) app or using the API instructions below:

## Send Mass Push Notification API

Post to this URL:

```bash
https://app.nativenotify.com/api/notification
```

Use this POST body (replacing the 'dateSent' with your current date as a string):

```bash
{
  appId: app-id-as-a-number,
  appToken: "app-token-as-a-string",
  title: "Push title here as a string",
  body: "Push message here as a string",
  dateSent: "put your date here as a string"
}
```

**Notes:**

- Push notifications will NOT work on an emulator/simulator. Push notifications only work on an actual device.
- If you are using a non-javascript based server language like Python, specify that this is an 'application/json' post type in your post header.
