以编程方式在iPhone日历中添加自定义事件,但不删除它

时间:2016-01-27 10:51:30

标签: objective-c calendar ekeventkit

我以编程方式将事件添加到日历中,但现在我想从日历中删除它,因此创建事件ID&用它来从日历中删除事件,但它不起作用,请帮帮我..这里是我用来删除事件的代码,请帮帮我

 EKEventStore *eventstore = [[EKEventStore alloc]init];

 [eventstore requestAccessToEntityType:EKEntityTypeEvent completion:
  ^(BOOL granted, NSError *error) 
 {
  if (!granted) 
  {
   return ;
   }
   //addEventGranted = 1;
   EKEvent* eventToRemove = [eventstore    eventWithIdentifier:self.savedEventId];
   if (eventToRemove) 
  {
   NSError* error = nil;
  [eventstore removeEvent:eventToRemove span:EKSpanThisEvent commit:YES error:&error];
   }
 }];}

0 个答案:

没有答案