I am setting the fireDates of my UILocalNotifications and grouping them by date in my UITableViewController. I am setting the fireDate property as a value in the notification's userInfo dictionary. Now, I want to edit the notifications, which consists of finding the specified notifications, deleting them, and then recreating them with the new fireDate value.
My question is:
When I set the fireDate value, with a repeatInterval set to .Weekly, does fireDate always contain the original value of fireDate, or does it update itself weekly when the notification is fired?
I could not find anything in the documentation for UILocalNotification that signals that it does in fact change. I am assuming that it always contains the original fireDate value, even after years of firing the notification weekly.
Can anyone point me to any available documentation that explains this, or at least confirm my conclusion?
Well, it turns out that my thoughts were correct in that the UILocalNotification's fireDate property contains a value that corresponds to the fireDate that was initially set.
To test this, I created a UILocalNotification with a fireDate, waited a day after the notification fired, and then printed the fireDate value, which was the previous day's date (the date that I set the fireDate for).
Related
When I use AppleScript for a repeating event, I am able to reference each recurrence of an event, even if one or more of the repeated occurrences is canceled.
What I am having trouble with is how a "moved" occurrence is stored. So, this is one of the occurrences that is not at the same time but moved.
Imagine a weekly event at 9am every Monday. If on the third week, I drag the event in the calendar app to be at 10am rather than 9am on the Monday. I do not see anywhere in the event metadata that shows me the moved occurrence of the event.
I would appreciate any pointers.
I have tried looking at all the relevant event metadata. I am using Script Debugger as my tool.
Here is the code. I not only changed the time of the moved event, I also changed the name. This is looking for the name.
tell application "Calendar"
set sourceCalID to calendar id "4AA1E22C-0472-44D1-A582-31A7310AF9B4"
set howManyEvents to number of event of sourceCalID
set the_events to every event of sourceCalID
repeat with current_event in the_events
set summaryEvent to summary of current_event
log summaryEvent
end repeat
end tell
The apns-expiration field governs how long Apple will hold on to an apns message before giving up on delivering it (for example, if the device is turned off).
According to their docs, a value of zero means "no retention": meaning that if the message can't be delivered immediately, its discarded.
But what happens if the header isn't specified? In other words, what is the default behavior?
My information isn't based on documentation but rather on stats gathered from a multi-million users system. The policy at this time is to retain push messages for a long time (exactly how long I dont know - we've seen 1M seconds retention in some cases). Of course, as this isn't documented it could change in the future.
Note that this default value is similar to Google's policy (where the default is 2419200 seconds), with the exception that Google's policy is documented.
https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html#//apple_ref/doc/uid/TP40008194-CH11-SW1
"If this value is nonzero, APNs stores the notification and tries to deliver it at least once, repeating the attempt as needed if it is unable to deliver the notification the first time."
Literally this means that the absence of the value equals to 0.
I'm trying to understand how to use the kFSEventStreamEventFlagEventIdsWrapped event flag with FSEvents.
According to the documentation, the flag is sent to registered instances when the event id counter wraps around, thus rendering previous event id obsolete.
Now let's imagine the following scenario:
I register for FSEvents in my application;
When done processing FSEvents (my application quits for instance), I save the last event id encountered while processing events to be able to replay changes from that id;
While my application is not running, the event id counter wraps around.
My question is: How am I supposed to know the counter wrapped around? (Thus requiring me to re-scan the whole directory structure.)
I now have an answer directly from Apple.
The scenario was wrong to begin with. When saving the last event id treated, you must also save with it the UUID of the event stream. An event id is valid only for a given event stream, which is identified by its UUID (see FSEventsCopyUUIDForDevice()).
Whenever the event id counter wraps around, a new event stream UUID is generated. So if you relaunch the app after the event id counter wrapped around, your stored last event id won’t be valid anymore, and you’ll know it as the event stream UUID won’t be the same.
If you encounter the kFSEventStreamEventFlagEventIdsWrapped flag, it means the counter wrapped around while your app was open. However, there’s nothing particular to be done. You should just be sure to get the new event stream UUID if you want to save the last event id.
EDIT:
Event IDs do not wrap.
Here is why: Suppose your machine generates 1 filesystem event per millisecond. This means it will generate ms_per_year=31536000000 filesystem events per year. So it will take more than 500 million years before the counter will wrap around the 64bit boundary.
>>> ms_per_year = 1000*60*60*24*365
>>> d64 = 2**64
>>> d64/ms_per_year
584942417L
If kFSEventStreamEventFlagEventIdsWrapped is set, it means the 64-bit event ID counter wrapped around. As a result, previously-issued event ID's are no longer valid arguments for the sinceWhen parameter of the FSEventStreamCreate() functions.[1]
Next time your should use kFSEventStreamEventIdSinceNow for FSEventStreamEventId and you must rescan all directory.
I have been having some trouble with reminders as of lately. I was wondering how the snooze feature works? When snooze is pressed on a reminder, is a new reminder created or is the same reminder scheduled for later?
The reason i ask is that i want to update a textblock in my app that shows the time of the reminder. My first thought was to look upp the reminder that has been snoozed and check the BeginTime property of the returned ScheduledAction. But this property had not been changed since the reminder was first created.
So, simply put, how do i get the scheduled time for a ScheduledAction including one or more possible snoozes ?
thanks!
You can't get this information.
All you can do is trigger the notification and then it's up to the user to respond to the notification as they feel is appropriate.
That doesn't mean you can't include additional reminder information within your app, if appropriate.
is there any way to observe any change to [NSUserDefaultsController sharedUserDefaultsController]?
I know I can observe a single value but I'd rather consolidate all these individual observers into one.
You can observe the NSUserDefaultsDidChangeNotification notification.