FCM iOS Integration (Step by step)

Bhavneet Singh
4 min readJun 4, 2018

Hey Guys,

Let’s have some basic knowledge of what we are going to integrate in a few minutes.

Firebase

What is FCM?

Firebase Cloud Messaging (FCM) is a cross-platform messaging solution that lets you reliably deliver messages at no cost.

Using FCM, you can notify a client app that new email or other data is available to sync. You can send notification messages to drive user re-engagement and retention. For use cases such as instant messaging, a message can transfer a payload of up to 4KB to a client app.

FCM Integration

Now, We should not take much time to start integrating FCM.

Here are the steps to integrate.

Step 1

Create a new project or you can start with the existing project.

After that go to the your Apple developer’s account and add an app

Register Application on Developer’s Account

Step 2

Enable Push Notifications in App Services Section, Create certificates for development as well as production.

You’ll see a screen like below

Upload CSR file

Now you just have to create a CSR file. For creating it open Keychain Access then click on the Keychain Access button on the top left corner and go to the Certificate Assistant then Request a Certificate from Certificate Authority.

After that a window will open on which you have to enter your email as User Email Address and click on Save to disk Radio Button, now tap on continue button to create CSR.

Back to our upload CSR Screen, Click on the Choose File button, Select your file then Continue after that you must see a Download button so that you can download it.

Step 3

You just downloaded Development and Production Push Certification, Install them or add them to your Keychain.

Keychain Access

Now export them separately as .p12 file.

Step 4

We have done half of the integration in just few minutes.

Now this is to Setup your project on Firebase and it will be very easy.

Click on above link to start setting up the project and come back after setup, I’ll be waiting on Step 5

Step 5

Open your project in Firebase so we can finish the remaining things.

Firebase Project

Once you open your project, you’ll see a screen as above screen and now click on button which is circled with red colour then 2 options will be available now, choose Settings from them.

Now you’ll be at below screen.

Project Settings

Click on the red circled button, then scroll down to iOS app configuration Section

iOS App Configuration

Now Upload the exported certificates which you have export in Step 3.

You’re now done with Firebase Setup.

Step 6

Tired of setups? Okay, Now we will do some coding to finish the integration.

Let’s Starts with Cocoa Pods.

Install above pods.

Now Create a new Swift file and copy below code and paste into new file.

At last Add below code to AppDelegate.

Now we have finished the FCM Integration.

Lets test the push notification. For start testing open your project in Firebase, Scroll down the left side menu to the Grow Section then click on the cloud messaging tab and start testing.

Watch below video for reference.

That’s All Guys, Hope you all did not face any difficulty while integrating.

If anyone needs any help or if I am wrong at any point in this Article, Please mail me.

My Email — bhavneet0812@gmail.com

After that go to the your Apple developer’s account and add an app

--

--