December 2012
Intermediate to advanced
834 pages
27h
English
You want to get notified in your application when the user changes the contents of the Calendar database.
Register for the EKEventStoreChangedNotification
notification:
-(EKCalendar*)calDAVCalendarWithTitleContaining:(NSString*)paramDescriptioninEventStore:(EKEventStore*)paramEventStore{EKCalendar*result=nil;for(EKCalendar*thisCalendarinparamEventStore.calendars){if(thisCalendar.type==EKCalendarTypeCalDAV){if([thisCalendar.titlerangeOfString:paramDescription].location!=NSNotFound){returnthisCalendar;}}}returnresult;}-(void)eventsChanged:(NSNotification*)paramNotification{NSMutableArray*invalidatedEvents=[[NSMutableArrayalloc]init];NSLog(@"Refreshing array of events...");for(EKEvent*eventinself.eventsForOneYear){if([eventrefresh]==NO){[invalidatedEventsaddObject:event];}}if([invalidatedEventscount]>0){[self.eventsForOneYearremoveObjectsInArray:invalidatedEvents];}}-(BOOL)application:(UIApplication*)applicationdidFinishLaunchingWithOptions:(NSDictionary*)launchOptions{self.eventStore=[[EKEventStorealloc]init];EKCalendar*calendar=[selfcalDAVCalendarWithTitleContaining:@"vandad.np@gmail.com"inEventStore:self.eventStore];NSTimeIntervalNSOneYear=1*365*24*60*60;NSDate*startDate=[NSDatedate];NSDate*endDate=[startDatedateByAddingTimeInterval:NSOneYear];NSArray*calendars=[[NSArrayalloc]initWithObjects:calendar,nil];NSPredicate ...
Read now
Unlock full access