How to Unsubscribe topic for notification in swift

Updated 28 February 2023

Save

Hello Guys, Today we learn about “How to Unsubscribe topic for notification in swift“.
Sometimes we want to push the notification stores-wise into our app. For example, If I am using multiple stores like Arabic, English, French e.t.c and want to push the notification to the customer according to store. means if I am using an English store then I receive only English store-related notifications. for this, we use the subscribe and unsubscribe token functionality.

Getting Started:-


Integrate Firebase push notification into your app notifications

For firebase push notification configuration, please go through this link, Please click here.
Here you can find how can we integrate the firebase notification into the app.

Now, apply the code in your project where you are using the store selection functionality.

when you switch the store from x to y you need to add below mentioned code.

Explanation:- To unsubscribe from the notification we need to delete the registered token first, on completion we will unsubscribe from the added topic, on completion we will again subscribe to the new topic. and after that, we need to call AppDelegate Function where we registered our topic and token. so that we can register the token and topic for notification.

Important note, you need to do the changes from the server side too, your server team also need to configure the notification according to the topic from the admin panel

Conclusion:-

In this blog, we discussed, “How to Unsubscribe topic for notification in swift”.
I hope this blog will help you to understand the notification unsubscribe ams subscribe flow
To learn more about iOS-related topics, please click here.

Thanks For Reading!!!

author
. . .

Leave a Comment

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


Be the first to comment.

Start a Project


    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home