Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find out when a repeating UILocalNotification was fired

I have a UILocalNotification that is set to start at 2012-06-18 10:00 with a repeat interval of 1 minute.

At 2012-06-18 10:05 5 notifications would have been triggered. The user would then choose notification number 3. The notification should have been fired at 2012-06-18 10:02.

In my - application:didReceiveLocalNotification: method. How can I programatically get this fire date from notification number 3 which should be 2012-06-18 10:02. I know I can get the intitial/start fireDate property from the UILocalNotification but I'm not interested in that. I'm interested to know the fireDate of this repeating notification (not the intial/start fireDate).

If someone can explain to me how to find out which repeating UILocalNotification was fired without parsing the - description of the notification I will give you some of my hard earned bounty.

like image 210
Peter Warbo Avatar asked Nov 26 '25 14:11

Peter Warbo


1 Answers

So I have given this a bit more thought, and as I said in my comment it doesnt seem possible because of the way notifications are handled.

You create one and fire immediately or schedule it.

A notification is just the storage of some information which means it is only meant to be read for its properties.

The application receives the notification through

application:didReceiveLocalNotification:

In where only the UILocalNotification itself is passed. This notification ONLY has a bunch of properties which were set at the start.

The repeat interval is only used to re-notify the user, it doesnt change what the notification has inside.

This comes to the conclusion that for the behavior you expect to achieve you would have to fire different notifications if you expect to pass different information or perform different actions.

(Sub-classing is also not useful as explained here https://stackoverflow.com/a/8583329/1068522)

like image 90
Pochi Avatar answered Dec 05 '25 00:12

Pochi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!