Adding EKParticipants to an EKEvent in EventKit

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 16:00:02

问题


I'd like to programatically add a participant to an EKEvent on the iPhone.

EKParticipant's class reference states "You do not create EKParticipant objects directly. Send attendees to an EKEvent object to get an array of EKParticipant objects.".

EKEvent's class reference states that the 'attendees' member (NSArray) is "The attendees associated with the event, as an array of EKParticipant objects. (read-only)"

Seems like a chicken-and-egg scenario - how does one "Send attendees to an EKEvent object", if the attendees member a.) is read-only and b.) contains objects that cannot be directly created?


回答1:


If you want to add attendees to an EKEvent, you must implement EKEventKitUI, and use the view controllers of that framework, this framework provide the calendar native like views so you can add attendees for your EKEvent.

But you can't add attendees to EKEvent programmatically since the attendees is a read- only property, so you ca't set it's value by code, and since you ca't create EKParticipant object directly by code.

may be this limitation change in coming versions of iOS.



来源:https://stackoverflow.com/questions/3669643/adding-ekparticipants-to-an-ekevent-in-eventkit

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!