Is there a way to add an identifier or custom event tag to iCal?

I set a reminder in my application. I added a custom event using EKEventto iCal. Now, when I retrieve events from iCal, I get all the events present on that day. Is there a way to get / receive events added only through my application, I tried a eventIdentifierproperty EKEvent, but this is a readonly property. Can someone help ???

+3
source share
2 answers

You can view all calendar events corresponding to a specific date, but this is not the most preferred method. Each event is created with the unique eventIdentifier property. When you save an event, you can copy the eventIdentifier, and the next time you want to change that particular event, you can use the EQEventStore eventWithIdentifier method to load your event.

An example might look like this:

   EKEventStore *eventStore = [[EKEventStore alloc] init];
   NSError *err;
   EKEvent *event  = [EKEvent eventWithEventStore:eventStore];
   //modify all the event properties you would like then save
   [eventStore saveEvent:event span:EKSpanThisEvent error:&err];
   self.calendarEventID = event.eventIdentifier; 
   [eventStore release];

Later, if you want to get the saved event from the previous code, you can do the following

   //self.calendarEventID is a NSString property declared in the .h file and synthesized in .m
   EKEvent *myEvent = [eventStore eventWithIdentifier:self.calendarEventID];
+3
source

blooper:

I had a similar problem with AppleScript to configure iCal alarms; I would like to identify and remove the events that my script made in the next pass.

- iCal, location, ; "" . (Caveat: , parens, .)

location , . , , , .

+1

Source: https://habr.com/ru/post/1792979/


All Articles