EventKit: dueDateComponents vs Alarm Reminders

I want to create a reminder from my application, so I created a reminder (EKReminder) and set an alarm:

NSTimeInterval timeInterval = 100000; NSDate *alarmDate = [NSDate dateWithTimeIntervalSinceNow:timeInterval]; EKAlarm *alarm = [EKAlarm alarmWithAbsoluteDate:alarmDate]; [reminder setAlarms:@[alarm]]; 

but I see that on EKReminder there is also a dueDateComponents property. What is the difference between setting an alarm and dueDateComponents?

There is also a method for creating an alarm: alarmWithRelativeOffset:(NSTimeInterval)offset , but the docs say the offset argument can be negative, how can you have an alarm in the past?

+6
source share
3 answers

a EKReminder element is similar to a task in the task list with an optional start date and a set date; the dueDateComponents property allows dueDateComponents to specify when the task should be completed. This will allow you to display expired items, for example. It is informational and separate from anxiety.

Setting the alarm in the reminder will cause the reminder application to notify the user when the alarm goes off.

I assume this is a bit confusing because the reminder app does not allow you to set a payment date, only a warning date. However, on this blog, it shows how you could set a date, but not a reminder date on icloud.com: http://blog.truthdialogue.com/2012/07/setting-due-dates-in-the-os-x- mountain-lion-reminders-app.html . It seems that Apple has simplified applications since the development of the API.

The offset for alarmWithRelativeOffset: comes from the start date / time of the event. Thus, you can set the alarm to go x minutes before the event, for example.

+8
source
  EKAlarm *reminder = [EKAlarm alarmWithRelativeOffset:-00]; [event addAlarm:reminder]; 
0
source
 let alarmist : EKAlarm = EKAlarm() alarmist.relativeOffset = -0 reminder.addAlarm(alarmist) NSLog("reminder has alarm ->" + reminder.hasAlarms.description) 
0
source

All Articles