iphone - Properly subclassing the EKEvent Class -


I am having any problems, which open the EKEvent class. The scenario is, I am pulling all my events from an external database using a webservice, so all events come with an ID. I want to keep these events in the device calendar and then retrieve them later. Want to The problem is that when I retrieve the event, I need an identical ID similar to the event that happens on the server, so I can see it instantly to get additional information on the event.

I know that the property EKEvent of Identifier is read-only, so I want to create a sub class of class where I have an additional asset Can be added such as myid and event ID (one from the server) in the eventstore. I have tried to create a subclass and everything works fine and compiles, but at runtime, I get an error when I try to set up additional event id property which I add to the subclass, error Message is:

  Exclude the application due to exception exception, 'NSInvalidArgumentException', Reason: '- [EKEvent setEventId:]: 0x83c0770 sent to unknown selector for example'   

In this There are some test codes to use: Create an Event from my EKEvent subclass:

  SectureEvent * myEvent = (SectureEvent *) [EKEvent eventWithEventStore: eventDB]; MyEvent.title = self.evento; MyEvent.startDate = [[NSDate alloc] init]; MyEvent.startDate = [NSDT Date]; MyEvent.endDate = [[NSDT Alok] Init]; MyEvent.endDate = [[NSDT Alok] Init]; MyEvent.allDay = Yes; MyEvent.eventId = self.eventId;   

Error Last Line myEvent.eventId = self.eventId; And if the app is on crash, then my question if I can effectively leave the EKEvent class and if so, what am I doing wrong here?

Thanks in advance!

class = "post-text" itemprop = "text">

ekeivent does not mean to be sub-classified Event Kit Objects Database The creation of the subclass of EKEvent is used to represent the record, the Magic Event Kit database will not include the new field, nor do some one EKEvent casting And that object will change the class.

The only way to store additional fields in the database is to have direct access to that database, which Apple reserves for itself.

As you can not add new fields to the event kit database, you can either use the existing field (for example, add event IDs to events in the event) Expand with managed second database.

Just create a SQLite database (or a property list file), or the format you want) that associate your event ID to EKEvent identifiers.

Comments