iosdeprecated

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?


Solution

  • How about this:

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