Home:ALL Converter>EKEventStore: 'initWithAccessToEntityTypes' is unavailable: not available on iOS

EKEventStore: 'initWithAccessToEntityTypes' is unavailable: not available on iOS

Ask Time:2020-06-04T11:17:24         Author:Jon Schneider

Json Formatter

I'm attempting to set up an EKEventStore to (with their permission) display the user's calendar events in an iOS app.

The first couple of Apple documentation pages that I've come across on how to initialize the EKEventStore instance (1. Accessing the Event Store; 2. Reading and Writing Calendar Events) say to do so like this:

EKEventStore *eventStore = [[EKEventStore alloc] initWithAccessToEntityTypes:EKEntityMaskEvent];

However, in a fresh iOS application created using the latest Xcode (version 11.3) with the "Single Page Application" template, with the above line of code added to the viewDidLoad method of the ViewController.m, Xcode gives this error:

'initWithAccessToEntityTypes' is unavailable: not available on iOS

What's the correct way to initialize EKEventStore in an iOS app?

Author:Jon Schneider,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/62186275/ekeventstore-initwithaccesstoentitytypes-is-unavailable-not-available-on-ios
yy