Alberto Schiariti
Alberto Schiariti

Reputation: 1579

Objective-c Check if calendar exists

I searched a lot and even if this question seems simple seems there is no clear answers. How do I retrieve a calendar programmatically? I need to save one and avoid to create it if it already has been saved.

I did something like:

myEventStore = [[EKEventStore alloc] init];
EKEvent *myEvent = [EKEvent eventWithEventStore:myEventStore];
[myEvent setCalendar:[myEventStore calendarWithIdentifier:@"Infinity"]];

And checked if "myEvent" was nil, but it didn't help.

Upvotes: 0

Views: 309

Answers (1)

Sulthan
Sulthan

Reputation: 130102

You can list the calendars by [EKEventStore calendars], in iOS 6 deprecated in favor of [EKEventStore calendarsForEntityType:].

Upvotes: 1

Related Questions