Problems Accessing Calendar Using Ekeventstore on Osx Sierra with Swift 3

Problems accessing Calendar using EKEventStore on OSX Sierra with Swift 3

You need to add a usage description to your info.plist. This is a small description of why you need access to the services that is presented to the user.

<key>NSCalendarsUsageDescription</key>
<string>Description of why you need access to the Calendar</string>

EKReminder error when creating on OS X: No calendar has been set

Instead of using:

EKCalendar *reminderCalendar = [EKCalendar calendarForEntityType:EKEntityTypeReminder eventStore:eventStore];
NSLog(@"Using EKCalendar: %@", reminderCalendar);
reminder.calendar = reminderCalendar;

I was able to create the EKReminder successfully using:

reminder.calendar = [eventStore defaultCalendarForNewReminders];

Mavericks, SandBoxed, but deployment target to 10.8 and above using EKEventStore and calendar access

To have an App that runs on several OS versions:

  • Set your Base SDK to the latest version of the OS you support, in your case 10.9
  • Set the Deployment Target to the earliest OS you want your code to launch on
  • For all calls that don't exist in earlier versions of the OS, you must test before you call, either by using respondsToSelector: (for methods) or testing against nil (for functions and statics). You can if you like do a check for the OS version, but it's more robust to check the specific call.

see also:
How to conditionally use a new Cocoa API and
How do I include calls to methods only present in one operating system version when compiling for multiple versions?



Related Topics



Leave a reply



Submit