Documentation > iOS

Prerequisites

Let's get going! The very first step is to go to the dashboard and create your mobile app.

Registering a new app

Once your app is created, you'll find the API keys needed to set up the SDK in ⚙ Settings → General:

  • Dev API key: Use it for development or testing purposes. This API key won't trigger stats computation. Please take care not to ship an app on a Store with this API key.
  • Live API key: Should be used in a production environment only and in the final version of your app on the Store.

Now let's generate your Push certicates and upload them to Batch's Dashboard. If you already have valid certificates, you can jump to the next step.

Important
These API keys must not be mistaken for the APNS environment Batch will output to the Xcode logs when starting. The environment depends on the app's provision, not on the Batch API Key used.

Creating a certificate

Batch servers need to have a certificate in order to communicate with Apple Push Notification Services (APNS). This certificate is generated for an unique Application Identifier (App ID).

Step 1.

Open your Keychain application on your Mac. In the menu bar, select "Keychain Access" → "Certificate Assistant" → "Request a Certificate From a Certificate Authority…"

Keychain

Then, enter your information in the required fields and select "Saved to disk". Save the "CertificateSigningRequest.certSigningRequest" file to your Desktop.

Certificate

Step 2.

Head to the Apple Developer Member center and create a new App ID (or choose an existing Explicit App ID) to configure Push Notifications. Select it from the list, then click on "Edit".

New app ID

Scroll down to the Push Notifications section.

SSL certificate

Under "Production SSL Certificate", click on "Create Certificate...". The Production certificate is capable of pushing both sandbox and production environments.

The next screen will show instructions for creating a Certificate Signing Request (CSR).

Create Certificate

Select "Choose File…" and locate the .certSigningRequest file on your desktop. Finally, select "Generate" and download the generated SSL certificate from the "iOS App ID Settings" screen.

Generate Certificate

Generating the P12 file

Now you have the certificate, you need to have it with its key bundled into a .p12 file format.

Step 1.

First, add the certificate to your Keychain by double clicking on the downloaded SSL certificate.

In Keychain Access, under "My Certificates", find the certificate you just added. It should be called "Apple Push Services:".

Certificates called "Apple Production IOS Push Services" and "Apple Development IOS Push Services" are not supported anymore. Please generate a new Production Certificate

Step 2.

Right-click on the certificate, select "Export Apple Push Services:…", and save it as a .p12 file.

IMG3

You will be prompted to enter a password which will be used to protect the exported certificate.

IMG4

If the Personal Information Exchange (.p12) option is grayed out in the export sheet, make sure "My Certificates" is selected in Keychain Access.

Step 3.

Now go to Batch's dashboard → ⚙ Settings → Push settings, and upload your P12 certificates.

BatchSettings

Troubleshooting
If you're having trouble uploading your certificate, you can check our troubleshooting documentation.

Generating your Provisioning Profile

After creating a new App ID or modifying your existing one, you need to (re)generate your provisioning profile and build with it.

Step 1.

Go to Apple Developer website, then click on "Provisioning Profiles" from the iOS Apps section.

Click on the "+" button to create a new iOS Provisioning Profile or select an existing one.

If you already have one, make sure it has Push Notifications in the Enabled Services field.

Step 2.

In the Provisioning Profile creation wizard:

  • Select Type: Choose "App Store".
  • Configure: Choose the App ID you created before from the drop down and make sure to select your iOS Production certificate.
  • Generate: Choose a name for this provisioning profile, such as "Batch Push App Profile" and select "Generate"

Then download the generated provisioning profile from the next screen by selecting the "Download" button.

Step 3.

Install the profile by double-clicking on the downloaded file.

Your new provisioning profile should appear in the Provisioning Profiles section in your Xcode settings under the "Accounts" section. Make sure that your developer certificate is installed in your Keychain.

Batch Push campaigns are sent to both the apps built with your Development and the Distribution provisioning profile.