EKParticipant in EventKit erroneously returns NO for isCurrentUser property

删除回忆录丶 提交于 2019-12-03 10:31:34

Organiser of the event is not by default in the attendees list, you explicitly add him as attendees.

Organiser is considered different from attendees and is depicted with attribute organiser. If you use that object to access isCurrentUser it will provide you value Yes.

If you explicitly add the organiser email id as attendee it is considered different user, for that you need to compare attendees URL and check.

Example : User a..@a.com organised a meeting or event and invited b..@b.com then in attendees you will have only b..@b.com and a..@a.com will be available as organiser.

In case you add a..@a.com as attendee also then its property isCurrentUser is No and you can check by comparing the attendees URL string itself with organiser.

SeanChense

Yes you can determine which attendee of ekevent is the current user.

I found a way to make isCurrentUser work for any participant. According to https://stackoverflow.com/a/17222036/3683845 we can get attendee's email with EKParticipant.URL.resourceSpecifier

Well, you will get right email expect two guys. The one is the organizer, another is current user who uses the AppleID on this device.(If the event is an invitation)

When you access these two guys, their resourceSpecifier is something like

/aMTA3MDAxMjE0MzEwNzAwMb6Y7GrNw2OCqzA8gkpxsctNZJxrzpebHm/principal/

not the email format.

UPDATE

It works for my iPhone on 9.3.2.

I can distinguish which one is current user in attendees.

When talk to event's organizer, if there is no invitee the organizer will be nil meaning this event is created by current user but organizer.isCurrentUser will be NO. Because organizer is nil.

When user invites some others to attend this event, organizer will be not nil and its isCurrentUser will be YES

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