Skip to content

Reminders

levching edited this page Apr 15, 2020 · 3 revisions

Reminders are tasks that may be tied to a specific time or location. They are similar to calendar events may not necessarily span an exact period of time.

You can perform the same methods on a reminder as you would on an event, such as adding an alarm or setting a recurrence rule with, see below.

To add alarm parameter to your reminder you need to create new ISN_EKAlarmDataRequest and set there dueDate or timeStamp like this for example:

ISN_AlarmDataRequest alarm = new ISN_AlarmDataRequest(System.DateTime.Now);

To add recurrenceRules parameter to your event you need to create new ISN_EKRecurrenceRuleRequest and set there frequency and interval also you need set endDate because if you what set it, it wil cause an error:

ISN_RecurrenceRuleRequest recurrenceRule = new ISN_RecurrenceRuleRequest(ISN_RecurrenceFrequencies.Monthly, 2, System.DateTime.Now);

You can create reminders using the ISN_EKEventStore.Instance.SaveReminder() method. The title paremeter required. Also you can set startDate and endDate parameters. An endDate required if you will add recurrenceRules.

Like events, reminders can trigger time-based alarms to alert the user of a certain task.

To save a reminder to the Calendar database, call the ISN_EKEventStore.Instance.SaveReminder() like this:

EKEventStore.Instance.SaveReminder("Test reminder", System.DateTime.Now, System.DateTime.Now, alarm, recurrenceRule, (request)=>
{
    if(request.Result.IsSucceeded)
    {
        Debug.Log("Yey, It's working! ID is - " + request.Identifier);
    }
    else
    {
        Debug.Log("We have error - "+ request.Result.Error.FullMessage);
    }
});

This request will return ISN_EKSaveResult object that contains Identifier of created event or error. You can use this Identifier for removing this event, to do this you need to call ISN_EKEventStore.Instance.RemoveReminder() method like this:

EKEventStore.Instance.RemoveReminder(m_ReminderID, (request) =>
{
    if(request.IsSucceeded)
    {
        Debug.Log("We removed reminder!");
    }
    else
    {
        Debug.Log("We have error at removing reminder!");
    }
});

About

Foundation

AV Foundation

App Tracking Transparency

Game Kit

Store Kit

UI Kit

Social

Replay Kit

Contacts

AVKit

Photos

App Delegate

User Notifications

MediaPlayer

Core Location

AdSupport

EventKit

CloudKit

Authentication Services

XCode

Knowledge Base

Clone this wiki locally