offex
offex

Reputation: 1885

Handling removal of EKEvent.recurrenceRule property

Apple recently removed the recurrenceRule property from the iOS 6 API so I am getting a compiler error saying it is not found on object of type EKEvent.

However, the replacement (recurrenceRules), was not added until iOS 5. If we want to support iOS < 5 what is the proper way to make the compiler happy?

Edit:
I added a category to EKEvent that redefines the recurrenceRule property, is this going to get the app rejected?

Upvotes: 2

Views: 993

Answers (1)

TomSwift
TomSwift

Reputation: 39502

How about this:

EKEvent* myEvent = ...;

if ( [myEvent respondsToSelector: @selector( recurrenceRule ) ] )
{
   EKRecurrenceRule* rr = (EKRecurrenceRule*)[myEvent performSelector: @selector( recurrenceRule ) withObject: nil];

   ...
}

Upvotes: 1

Related Questions