Raymond Brion
Raymond Brion

Reputation: 332

How to identify if an EKEvent has an EKParticipationStatus of pending (Not yet accepted)?

I have already tried the

if ([event participationStatus] == EKParticipantStatusPending)

and it is working. But the participationStatus of the EKEvent is not exposed and I'm afraid to use it as maybe it will result in a rejection because of a private API.

I have also tried looping through all of the event.attendees but it seems that the EKParticipant isCurrentUser does not give the correct value. It always returns NO

  for (EKParticipant* participant in event.attendees)

  {
    if ([participant isCurrentUser])

    {
      if (participant.participantStatus == EKParticipantStatusPending)

      {
        NSLog(@"NEEDS RESPONSE");
      }

    }

  }

Upvotes: 4

Views: 827

Answers (1)

SeanChense
SeanChense

Reputation: 846

Finally I found a tricky 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.

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

/aMTA3MDAxMjE0MzEwNzAwMb6Y7GrNw2OCqzA8gkpxsctNZJxrzpebHm/principal/

not the email format.

Upvotes: 1

Related Questions