Can not delete a single recurrent event from the store

Hi!

I find my self in a very annoying and frustrating situation..
i've developed an app that uses calendar using the eventkit.


The user can push a button and delete a specific event. Everything works just fine, except when it comes to recurrent events.


If the user itself created the recurrent events, it works as expected, the single event is deleted and the rest remains in calendar.

But if the recurrent events is created by other and accepted by user and then try to delete one specific of those events, they all disappear from calendar. why?

I hope i described my problem well enough, otherwise plz feel free to ask questions!


in this case iPad only uses one Exchange calendar, can the problem be exchangespecific?


Very thankful for any input/help on this!


Regards

Joakim Jonsson


see code:


/* Get the Exchange Calendar */
EKEventStore* store = [[EKEventStore alloc] init];
NSError* error = nil;
NSMutableArray* calendars = [[store calendarsForEntityType:EKEntityTypeEvent] mutableCopy];
NSMutableArray* cals = [[NSMutableArray alloc] init];
for (EKCalendar *cal in calendars) {
     if (cal.type == EKCalendarTypeExchange) {
          [cals addObject:cal];
          break;
     }
}
/* get the correct event, get Events with startDate & endDate and differ with eventId */
// (tappedEvent = event to remove)
NSPredicate *predicate = [store predicateForEventsWithStartDate:[tappedEvent valueForKey:@"from"] endDate:[tappedEvent valueForKey:@"to"] calendars:cals];
NSArray *theEvents=[store eventsMatchingPredicate:predicate];
NSString *recurrenceEventIdentifier = [tappedEvent valueForKey:@"appID"];
for(EKEvent * theEvent in theEvents){
     if([theEvent.eventIdentifier isEqualToString: recurrenceEventIdentifier] && ![store removeEvent:theEvent span:EKSpanThisEvent error:&error]){
          NSLog(@"Error in removing event: %@",error);
     }
}
[store commit:&error];
if(error){
     ...
}
Can not delete a single recurrent event from the store
 
 
Q