How to access an EKCalendar's `account` property

前端 未结 3 1829
执笔经年
执笔经年 2021-01-19 05:13

Take a look at the documentation for EKCalendar. It\'s pretty simple, it has five properties, only one of which is a string called title. Now if you have multip

相关标签:
3条回答
  • 2021-01-19 05:27

    This information is not available in the 4.0 SDK. Have you looked at the developer previews of the forthcoming SDK to see if that might contain more information?

    0 讨论(0)
  • 2021-01-19 05:29

    And on iOS6? It seems the private property [EKCalendar accountName] vanished. And [EKCalendar description] does not contain account anymore. :

    EKCalendar <0x200f50e0> {title = test@gmail.com; type = Exchange; allowsModify = YES; color = #44A703;}

    The [EKCalendar source] provides a EKSource object, that has a title but this is not the name I typed when I created the account but seems to be a more generic name, e.g. Exchange, Other, CalDAV.

    0 讨论(0)
  • 2021-01-19 05:30

    If you use class-dump on the iOS 4.3 (Simulator) SDK, you'll see that there's a read-only method -(id)accountName. However, since it's not in the headers, it's unfortunately private API and you can't use it if you want your App to be accepted in the App Store.

    I recommend that you file an enhancement request with Apple requesting that this method be made public.

    Though thinking about it: If you're really desperate, why not parse the output of -[EKCalendar description]? It's very very very bad style and it'll probably break in the future, but you might make it through the App Store review ;) In particular if you only use it for grouping and write your code extremely defensive so it doesn't break but simply doesn't group, should the output of the description method be formatted differently.

    0 讨论(0)
提交回复
热议问题