Should we use absolute or calendar Date when scheduling background tasks?
I would guess it doesn't matter how we construct Date but I wanted to double check since WWDC videos show both ways.
I've experienced some instances where background tasks ran much later than expected, and while this is not surprising since iOS has many factors to consider when they allot background execution time, the times of execution seemed to line up with the hours change between Absolute and Calendar time.
Or
And
I understand there is no guarantee that the system will run the background task exactly or even near the date requested.
Thanks!
The properties you’re working with here are of type Date
. A Date
value is a floating point offset from the epoch (the start of 2001 GMT) and thus, in your terms, it’s always absolute [1]. How you create that Date
value is up to you. If you want to generate it using Calendar
, that’s fine.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] I don’t consider it to be absolute because it’s based on the wall clock and thus can change if the device’s time changes, but coming up with words to discuss all these concepts is hard.