Quick Overview : Push Notifications setup for iOS + Firebase

Heres a quick overview of what needs to be where for iOS push notifications to work correctly, including Firebase management.  Its a little convoluted, so Ive sketched a diagram and I’ll talk through it.

Starting from the bottom and working upwards.  Apple Dev refers to the Apple Developer Site .  Team ID is something created automatically when you create an Apple Developer account.  This is used to create the Apple Key, which is a single key linked to your dev account that works for all your apps.  I won’t talk through the creation of all these elements here – safe to say its a simple process to follow on the Apple Dev site.  This (APNS) Key is the element that the Firebase console requires to be able to work with push notifications, alongside the Bundle ID of your project from XCode.  The Bundle ID is then entered on the settings page of your Firebase project.  Thats the only two pieces that Firebase requires from its end.  You can create this key early on in this process and upload it to Firebase.

Next up is the creation of the App Id.  This is used to identify the app throughout the portal.  Your Apple Dev Team ID is used in the creation of the AppID, along with the Bundle Id you entered into XCode, and entered again into Firebase settings.  When creating an App ID, you also tick boxes for various capabilities, one of which is Push Notifications.

From there, you can create the provisioning profile.  It takes this AppID, as well as a list of devices (already registered on the portal) that you want to use for testing, and it also takes your Developer Certificate (his is something you create separately, or which has most likely already been created on the portal via automatic signing).  This provisioning profile should then be downloaded and used in XCode.  Any builds created with that provisioning profile can then be tested for push notifications.

In terms of using Firebase for push, there are some other firebase – only elements to go through, which are clearly detailed on their site, so I wont go through them here.  As an overview, you need to install FirebaseMessaging (for eg via Cocoapods), then initialize firebase with a call in the app delegate, and add some apple functions that will register the APNS token with Apple.  Firebase then takes this APNS token, uploads it to firebase, and from then on you can send direct push notifications to any install of your app on a real device.

Leave a Reply

Your email address will not be published. Required fields are marked *