简体   繁体   中英

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

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!!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM