iOS APNs configuration

This guide explains the Configuration page of an iOS configuration in HoodEngage. Here you connect the configuration to Apple Push Notification service (APNs): choose the authentication method, choose the APNs environment, and upload your Apple credentials.

You can send to Sandbox, Production, or Both environments from one configuration. With Both, the same configuration delivers push notifications to development builds installed from Xcode and to TestFlight and App Store builds at the same time. You do not need to switch the environment or keep a separate configuration for testing.

To open the page, go to Configuration Hub, open your iOS configuration, and click Configuration under Other in the left menu.

Requirements
You need an iOS configuration in HoodEngage and a paid Apple Developer Account. Before you start, create a .p8 key or a .p12 certificate in your Apple Developer Account. For step-by-step instructions, see iOS p8 token-based connection or iOS p12 certificate-based connection.

Settings on the Configuration page

The fields on the page depend on the selected authentication method. The link in the page description also changes and opens the setup guide for that method.

SettingDescription
APNs Authentication Methodp8 (token-based) or p12 (certificate-based). p8 is recommended. p12 is deprecated.
EnvironmentProduction, Sandbox, or Both. Decides which APNs environment HoodEngage sends to.
APNs credential fileAPNs p8 key (a .p8 file) or APNs p12 certificate (a .p12 file), depending on the selected method.
Key IDThe 10-character Key ID of your .p8 key, from your Apple Developer Account. p8 only.
Team IDThe 10-character Team ID of your Apple Developer Account. p8 only.
Private Key PasswordThe password you set when you exported the .p12 certificate. Leave it empty if you did not set one. p12 only.
Apple bundle IDThe bundle identifier of your app, for example com.example.app. It must match the app that registers for push notifications.

The badge under the page description shows the credential that is saved for the configuration:

  • No file uploaded - no APNs credential is saved yet.
  • p8 uploaded - a .p8 key is saved.
  • p12 uploaded - a .p12 certificate is saved.

The badge changes only after you save. Selecting another method does not change it.

Choosing the authentication method

MethodWhen to use it
p8 (Recommended)Token-based authentication. A .p8 key does not expire, works for all apps in your Apple Developer Account, and supports Production, Sandbox, and Both with a single key.
p12 (Deprecated)Certificate-based authentication. A .p12 certificate expires after one year and works for a single app. Use it only if you have an existing certificate-based setup.
Important
p12 is deprecated. It still works for existing configurations, but we recommend moving to p8. A .p8 key does not need yearly renewal, so push delivery does not stop when a certificate expires.

Choosing the environment

Apple uses two separate APNs environments. A device registers in one of them, depending on how the app was installed:

  • Sandbox - development builds installed on a device from Xcode.
  • Production - builds installed from TestFlight or the App Store.
EnvironmentDelivers toWhen to use it
ProductionTestFlight and App Store builds onlyYour configuration serves only released or TestFlight builds.
SandboxDevelopment builds onlyYou test the app from Xcode and do not need App Store or TestFlight devices.
BothDevelopment, TestFlight, and App Store buildsYou test from Xcode and send to TestFlight or App Store users from the same configuration.
Note
With Both, HoodEngage sends each notification to the environment the device is registered in. You do not need to change any setting when you move between testing and production.

iOS APNs configuration with p8 selected

Configuration page with p8 and Both selected

Step 1: Open the Configuration page

  1. Open Configuration Hub and click your iOS configuration.
  2. In the left menu, under Other, click Configuration.

Step 2: Select the authentication method and environment

  1. Under APNs Authentication Method, click p8.
  2. Under Environment, click Production, Sandbox, or Both.

Step 3: Upload the .p8 key

Under APNs p8 key, drag and drop your .p8 file, or click the upload area to browse for it.

Step 4: Enter the key details

  1. Enter the Key ID. You can find it in your Apple Developer Account, under Certificates, Identifiers & Profiles → Keys.
  2. Enter the Team ID. You can find it in the top right corner of your Apple Developer Account.
  3. Enter the Apple bundle ID of your app.

Step 5: Save and publish

  1. Click Save in the top right corner of the page. HoodEngage checks the key, Key ID, and Team ID with Apple. If a value is wrong, the settings are not saved and an error message is shown.
  2. Click Publish at the top of the page to apply the changes. For more information, see Publishing changes.

After you save, the badge changes to p8 uploaded.

Step-by-step guide: Setting up APNs with p12 (deprecated)

iOS APNs configuration with p12 selected

Configuration page with p12 and Both selected

Step 1: Select the authentication method and environment

  1. Open the Configuration page of your iOS configuration.
  2. Under APNs Authentication Method, click p12.
  3. Under Environment, click Production, Sandbox, or Both. To use Both, you need a universal certificate. See Using Both with a p12 certificate.

Step 2: Upload the .p12 certificate

  1. Under APNs p12 certificate, drag and drop your .p12 file, or click the upload area to browse for it.
  2. Enter the Private Key Password, if you set one when you exported the certificate.
  3. Enter the Apple bundle ID of your app.

Step 3: Save and publish

  1. Click Save in the top right corner of the page.
  2. Click Publish at the top of the page to apply the changes.

After you save, the badge changes to p12 uploaded.

Using Both with a p12 certificate

To use Both with p12, upload a universal certificate. A universal certificate works in Sandbox and Production. In Keychain Access, its name is Apple Push Services: your.bundle.id. To create one, select Apple Push Notification service SSL (Sandbox & Production) in your Apple Developer Account. See iOS p12 certificate-based connection for the steps.

Older certificates that work in only one environment are not accepted for Both:

Certificate name in Keychain AccessWorks inAccepted for Both
Apple Push Services: your.bundle.idSandbox and ProductionYes
Apple Development IOS Push Services: your.bundle.idSandbox onlyNo
Apple Sandbox Push Services: your.bundle.idSandbox onlyNo
Apple Production IOS Push Services: your.bundle.idProduction onlyNo

You can still use a Sandbox-only certificate with Sandbox, and a Production-only certificate with Production.

Switching between p8 and p12

If a credential is already saved, for example the badge shows p8 uploaded, and you select the other method, the Confirm APNs method switch checkbox appears at the bottom of the page.

  1. Select the new method and upload the new credential file.
  2. Fill in the fields for the new method.
  3. Select Confirm APNs method switch.
  4. Click Save, then Publish.
Important
When you save, the new credential replaces the saved one. Make sure the new credential is valid for your app before you switch.

Existing configurations

Configurations already set to Production or Sandbox keep working as before. To start using Both, open the Configuration page, click Both, then save and publish. If you use p12, check that your certificate is universal first.

Troubleshooting

Both cannot be saved

Cause: Both needs a .p8 key or a universal .p12 certificate.

Fix:

  • Check that a credential file is uploaded. If the badge shows No file uploaded, upload a .p8 key or a .p12 certificate.
  • If you use p12, check the certificate name in Keychain Access. If it is a Sandbox-only or Production-only certificate, create a universal certificate or switch to p8.

Notifications reach TestFlight devices but not Xcode builds (or the other way around)

Cause: The environment is set to Production or Sandbox, so devices registered in the other environment do not receive notifications.

Fix: Set Environment to Both, then save and publish.

The p8 key is rejected

Cause: The Key ID, Team ID, or key file does not match.

Fix: Check that the Key ID belongs to the uploaded .p8 file and that the Team ID is from the same Apple Developer Account. For more checks, see p8 troubleshooting.

Changes do not take effect

Cause: The settings were saved but not published.

Fix: Click Publish at the top of the page.

Best practices

  • Use p8 - A .p8 key does not expire and supports all three environments with one key.
  • Use Both while you test - Keep Xcode test devices and TestFlight or App Store users on one configuration.
  • Check the bundle ID - The Apple bundle ID must match the app that registers for push notifications.
  • Move away from p12 - If you still use a .p12 certificate, plan the switch to p8 before the certificate expires.