How to persist a variables value in Notification Service Extension on subsequent push notification

112 Views Asked by At

Is there a way somehow we can persist a variable's value in NSE.

Suppose i got a Bool variable i set it's value to true upon arrival of push in NSE and show the notification upon my work, now i got another push notification after some time is there a way i still get this variable's value as true ??

Currently i always get it's value as false which is default. I know it makes sense since iOS terminates the extension when we show the notification, but i need to something based on this requirement

Any pointers?? Please!! Thanks!!

1

There are 1 best solutions below

0
On

In order to solve this issue, i rather used the shared userDefault.
Since its shared space, the value is persisted there.