Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EKParticipant in EventKit erroneously returns NO for isCurrentUser property

I'm attempting to determine which of an EKEvent's attendees (EKPartipants) is the current user. In iOS6, EKParticipant exposes a property called isCurrentUser

http://developer.apple.com/library/ios/#documentation/EventKit/Reference/EKParticipantClassRef/Reference/Reference.html#//apple_ref/occ/cl/EKParticipant

which is supposed to provide precisely this information. Unfortunately, each time I lookup an EKParticipant's isCurrentUser property, it returns NO, even when that's clearly not the case.

Any help would be much appreciated!

Updated findings:

If you look up the event organizer, it correctly returns isCurrentUser == YES if you're the organizer. But, if you retrieve yourself from the set of attendees, it returns isCurrentUser == NO.

Example console output with the two different EKParticipant objects referring to the same person with the same email address:

(lldb) po [ekEvent.attendees objectAtIndex:3] $20 = 0x208c1220 EKAttendee <0x208c1220> {UUID = CCD17C5E-FCB5-4BC9-8D9E-7E957B20025D;        name= ----- -----; email = [email protected]; status = 2; role = 0; type = 1}  (lldb) print [(EKParticipant *)[ekEvent.attendees objectAtIndex:3] isCurrentUser] (BOOL) $15 = NO  (lldb) po ekEvent.organizer $19 = 0x20b720e0 EKOrganizer <0x20b720e0> {UUID = FD0E434D-2C9F-4A6E-98DC-     7FA6F27C3D1E; name = ----- -----; email = [email protected]; isSelf = 1}  (lldb) print ekEvent.organizer.isCurrentUser (BOOL) $16 = YES 
like image 662
Rahul Jaswa Avatar asked Mar 26 '13 02:03

Rahul Jaswa


1 Answers

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 [email protected] organised a meeting or event and invited [email protected] then in attendees you will have only [email protected] and [email protected] will be available as organiser.

In case you add [email protected] as attendee also then its property isCurrentUser is No and you can check by comparing the attendees URL string itself with organiser.

like image 76
GauravMantrao Avatar answered Sep 18 '22 20:09

GauravMantrao