Common issues with Push in iOS

Joel Oliveira
Joel Oliveira
Sep 25 2023
Posted in Best Practices

Getting it right, the first time!

Common issues with Push in iOS

It's back to basics folks! In this post, I will highlight some mistakes we still see happening with teams of every size. Let's review the most common issues we see happening when implementing iOS remote notifications with Notificare.

Development vs Production

Managing different configurations for development, staging, and production environments can be error-prone. Nevertheless, when implementing Push in iOS, this is the only way you can make sure things work correctly when you switch environments, can be independently tested, and that you don't accidentally send a This is a test to all your users.

For these reasons, we always suggest you to create different Notificare apps for all the different environments. There are two environments in Notificare, Development and Production. Development apps in Notificare, will always send messages to the APNs sandbox servers, while production apps will use APNs production servers.

It is also pretty easy, if you understand the basics:

Basically, a Notificare app in development should only be used by the actual app developers, when building directly from Xcode. Debug builds will always use APNS sandbox, therefore it should always use a Notificare development app. App Store or Testflight builds will use APNS production and therefore need to use a production Notificare app. Any other Ad-Hoc release you create (e.g. Acceptance) where builds are distributed over-the-air should also use a production Notificare app.

This alone, if done correctly, will save you from huge headaches. Any environment misconfiguration at this level, will result on delivery errors and devices being deactivated in Notificare after you send a push message.

Auth Keys vs SSL Certificates

Both Auth Keys and SSL certificates can be uploaded in Notificare. It's what we use to establish a secure communication with Apple's Push Notification Service (APNs), but they have some key differences.

Auth Keys

Auth Keys offer some advantages over SSL certificates. Namely, an Auth Key can be used for all the apps you create in Apple's Developer Portal. Auth Keys are also required if you want to send push notifications for certain features, like Live Activities.

You can only generate up to two different Auth Keys, and you can only download them once. If you lose that key, you may need to revoke it and change all the Notificare apps that use it.

SSL Certificates

Unlike Auth Keys, SSL certificates are specific to a certain bundle identifier. They also have an expiration date. This usually means that you will need to renew this certificate every year.

There are two types of SSL certificates you can generate in Apple's Developer Portal:

This certificate should be only used in Notificare development apps, and therefore can only be used for Xcode debug builds.

You can however generate SSL certificates that work for both development and production environments:

This certificate besides providing additional access to certain features, if you use this type of certificates, you will need to manage fewer certificates.

Bundle identifiers

An iOS Bundle Identifier, often referred to simply as a Bundle ID, is the unique identifier for an iOS app. It serves as a way to distinguish one app from another and is an essential part of the app's identity within the iOS ecosystem.

It is also important to understand that Notificare apps can only deliver messages to one single app. Although you can upload an Auth Key that can authenticate with APNs for all your apps, in Notificare you will always have to specify the Bundle ID, and we will only deliver messages to that app.

If you use different identifiers for each environment, it's important that you never mix them up. APNs will reject any message targeting a device token registered for a different bundle identifier than the one your Notificare app is configured for.

NotificareServices.plist

This is where you define the App Keys of a Notificare app. You usually download this file from our dashboard and include it in your app, to make our SDK work.

It's important to note that for every environment you build your apps for, you will need a different NotificareServices.plist. If you do change the keys in this file, it's imperative that you change with the keys of the corresponding environment.

Failing to do this will also lead to device registration and push delivery problems.

Easy, right?

Ensuring the correct configuration of Notificare apps and its different environments, Auth Keys and SSL certificates, Bundle identifier or Notificare's App Keys is paramount for any developer implementing iOS push notifications.

As always, you can find us available for any question you might have via our Support Channel.

Keep up-to-date with the latest news