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
Swiftui: Using View Modifiers Between Different iOS Versions Without #Available
How to Retrieve a Value from Dictionary in Swift 3
Calculate Time Difference in Swift 4
How to I Access Argv and Argc in Swift
Unknown Error When Adding an CSSearchableitem to Core Spotlight (Macos)
Nslayoutmanager Hides New Line Characters No Matter What I Do
How to Create Project Without Story Board in Xcode 6 (Swift)
Drawing a Gradient Color in an Arc with a Rounded Edge
Com.Apple.Itunes Aedeterminepermissiontoautomatetarget Is Always Return -600
Updating a @Published Variable Based on Changes in an Observed Variable
Firebase Auth Internal Error on Login Attempt
Create CSV File in Swift and Write to File
Require Associatedtype to Be Representable in a @Convention(C) Block
How to Cast an @Binding in Swift
Swift 3 Init Method That Accepts JSON with Optional Parameters