Skip to content

iOS Push Notification


We need an APNs Certificate for pushing on iOS

  1. Login Apple Developer Account
  2. Click Certificates, Identifiers & Profiles
  3. If you do not have the App ID, press '+' to create

Enter App ID Description :

Appid Desc

Enter Bundle ID :

Bundle id

Should be the same as the name we created when creating a project

Choose Push notifications :


  • Open Keychain

  • Click Request a Certificate from a Certificate Authority. : Keychain request

  • Create .certSigningRequest file : Keychain request

We choose the app we created in app ID's in apple developer accounts and click Edit. Choose Development or Production SSL Certificate then click Create Certificate:

  • We need to upload the generated file

Keychain request

  • Download .cer file

  • Double-click the .cer file and find it it installed in your Keychain Access: Keychain request

  • Select the certificate and press export :

Keychain export

Note the password you created

There are two ways to send :

  • Firebase
  • APNs


  • Create a project as follows :

Firebase Console

Add Project

  • Select iOS icon :

Select OS

  • Once you've entered your package name, put the GoogleService-Info.plist file in the root directory as shown in the image download step :

Download Config

  • Add the following codes to your podfile :

Gradle Config

  • Add to your AppDelegate class file:

Ios Init Config

  • If you complete these steps you will see a step to verify the following. (You can skip this step) :

Verify Step

  • Go back to the main page and click on the project settings :

Project Settings

  • Select cloud messaging and get server key :

Server Key

  • In iOS app configuration, we click on upload in APNs Certificates (We need to upload the .p12 file) :

p12 upload

  • After opening the project in Xcode, click on the project on the left side.

  • Select Capabilties and Activate push notification

Sgf Push Settings

If your information is correct, this will be green

  • After entering, enter the settings as below :

Sgf Settings

  • After selecting Push, click the iOS tab(Firebase) and enter your server key :

Sgf Push Settings

Select APNs if you want to send via apns and upload your .p12 file

Permission Info

Used to send deviceToken of users who give push permission.

InstanceID.instanceID().instanceID { (result, error) in
    if let error = error {
        print("Error fetching remote instange ID: \(error)")
    } else if let result = result {

        let obj = NotificationModel()
        obj.deviceToken = result.token
        obj.type = NotificationType.PERMISSION_INFO
        obj.providerType = ProviderType.FIREBASE
        SegmentifyManager.sharedManager().sendNotification(segmentifyObject: obj)


It will be sent when the user clicks notification.

We need to send data to the page after clicking :

let instanceId = userInfo["gcm.notification.instanceId"]
let productId =  userInfo["gcm.notification.productId"]

let obj = NotificationModel()
obj.instanceId = instanceId as! String
obj.productId = productId as! String
obj.providerType = ProviderType.FIREBASE
obj.type = NotificationType.CLICK
SegmentifyManager.sharedManager().sendNotificationInteraction(segmentifyObject: obj)                

instanceId and productId will be in the notification data

Information for Analytic Platform

This information is available if push information is sent to analytic platform

var utm_model = SegmentifyManager.sharedManager().getTrackingParameters();

The UTMmodel class is as follows :

public class UtmModel{

    public var utm_source:String?
    public var utm_medium:String?
    public var utm_campaign:String?
    public var utm_content:String?

See our sample application : Example

Example AppDelegate : Example AppDelegate

Example Notification Service : Example Notification Service