Search code examples
iphoneioscalendareventkit

Retrieving account information for an EKCalendar


I am using EventKit in my app and would like to find out what account a calendar belongs to.

The iPhone Calendar app shows all calendars grouped by account, with the account name for instance 'myname@me.com', or 'Gmail myname'. Where can I get those account names from?

I can get a list of EKCalendars from the EKEventStore and I can get each calendars title, but I have no idea where to get the account name from. Is there an official API for this? How else would I retrieve this information? Some apps on the App Store do display the account names, so there must be a way (that also slips through the approval process...)

Thanks, Thomas

Update: Somewhere else I found references to a private property. Before I start looking for that myself, does anybody know what the name of that property is?

Elsewhere people also suggested parsing the description (which includes the account), but that's not a very safe or elegant way, so I'd like to avoid doing that.

Update 2: I did find out that there is a private property (and its name) and it seems to work fine.


Solution

  • I've looked through Apple's documentation and the account name doesn't seem to be available through the public API. Your app will be instantly rejected if you use a private property, so I suppose those other apps on the App Store use the desciption parsing method.

    I suggest you post a bug report with Apple and request they make the account name available through the public API. Until they do (if they do), I think your only option is to parse the description if you want your app on the App Store