How to get already fired UILocalNotification

ぃ、小莉子 提交于 2019-12-05 14:25:31
Rygen

I had the exact same problem a few days ago. Luckily there's a rather simple way to cover that case!

Save the notification in NSUserDefaults, using NSKeyedArchiver to convert it to NSData. It's probably easier if you use the same key stored in the notification's userInfo dictionary.

Use NSKeyedUnarchiver to get it back as UILocalNotification. Then you're able to handle the notification as you see fit (or delete it using the cancelLocalNotification method).

Further explained here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!