Push Notification ios: How do I parse the "Title" field?

I was able to send push notifications from my app to an ios app (swift). I can see the alert pop up on my iphone.

But how can I parse the “Title” or “subtitle” of the alert in swift? Is there a reusable code fragment I can cut and paste?

My app Id is B78A830E-7A03-838E-FF36-46CF57DEF200. I have created a simple push template for testing there.

Thanks - Sanjay

Hello @Sanjay_Iyer

But how can I parse the “Title” or “subtitle” of the alert in swift?

Could you please provide a little bit more details about your goal?

Regards, Vlad

Hi Vladimir,

In the iOS app, I am using some of the data in the push notification to trigger some actions. I am passing the data field through “subtitle” right now. I figured out how to parse it in iOS through the nested data structure.

Ideally, I want to pass some data through headers. But the nesting makes it complicated. Is there is a simple way to parse the header data? Is there a code fragment I can reuse? And what if the data structure changes in future backendless releases? Don’t want to be stuck with a broken app when that happens.

Hello @Sanjay_Iyer,

You can parse push notification on the iOS side by using the application(_:didReceiveRemoteNotification:fetchCompletionHandler:) method.
We don’t provide specific methods to parse notifications in our SDK, but you can create your own reusable method for parsing and call it in the didReceiveRemoteNotification method.

And what if the data structure changes in future backendless releases?

We usually make the announcements several times before applying changes, so that they are not sudden for our users.

Regards,
Olha