且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

当iOS中的应用程序从设备中删除时,如何删除我的应用程序日历的所有事件

更新时间:2023-10-16 11:18:46



这是很直接,我们没有任何控制,当用户要删除应用程序从iPhone做一些行动。您可以在应用程序中提供删除所有事件选项,以通知用户正确的按摩。我认为用户至少单次使用您的应用程序,然后再删除。所以我想如果他/她有正确的想法,如何这个应用程序是工作,然后蔑视他们可以删除应用程序事件,然后删除应用程序。



实际上,我们没有任何选项,为什么我会建议你这一个。



实际上天气苹果处理这样的功能或不是由他们。因为一些时间事件不只是相关的应用程序,从添加生日事件从facebook不只是与facebook相关。用户需要提醒即使Facebook应用程序被删除。所以我认为苹果需要找出一些解决方案来处理这种情况。



希望这有助于你。


I am having a calendar with name MyCalendar.

I have stored some events to that calendar..

I know how to delete all the events from the calendar..as below

NSDate *startDate = [NSDate date];
NSDate* endDate =  [NSDate dateWithTimeIntervalSinceNow:[[NSDate distantFuture] timeIntervalSinceReferenceDate]];
NSArray *calendarArray = [NSArray arrayWithObject:self.defaultCalendar];

NSPredicate *predicate = [self.eventStore predicateForEventsWithStartDate:startDate
                                                                              endDate:endDate
                                                                            calendars:calendarArray];

NSArray *events = [self.eventStore eventsMatchingPredicate:predicate];

for (EKEvent *event in events) {
   NSError* err = nil;
   [self.eventStore removeEvent:event span:EKSpanFutureEvents commit:YES error:&err];

}

But when user deleted my app from device. How can I delete all the events related to Calendar MyCalendar.

As unnecessary some events of the deleted app still exists at device calendar.

It is worst to keep events related to My App if user don't want to use My App..

Any Ideas & Suggestions are appreciated..Is it possible?

Thanks in Advance..

It is pretty straightforward that we don't have any control to do some action when user is going to delete application from iPhone. May be you can provide Delete All Events option inside application to notify user with proper massage. i think user at least single time used your application before deleting. so i think if he/she has proper idea of how this app is working then defiantly they can delete app events from application and then deleting app.

Actually we don't have any option that why i would suggest you this one. what so amount of user taking advantage of this option will helpful for them.

Actually weather apple handle such functionality or not it up to them. because some time events is not just related to app like Adding birthday event from facebook is not just related to facebook. user need that reminder even though facebook app is deleted. so i think apple need to figure out certain solution from handling such situation.

Hope this help you.