iosobjective-cios7ekeventnscopying

Is there any way to copy EKEvent, or let it conform NSCopying protocol


I keep an instance of EKEvent and want to copy it. But I found EKEvent doesn't conform NSCopying protocol, so I try to add a category to EKEvent to let it conforms this protocol, however, eventIdentifier is a read-only attribute, so, this method failed.

Any way to do so?


Solution

  • Copying an EKEvent object is maybe not necessary. At first I want to make sure my new Custom class object is absolutely a copy of another one. However, what should do is create a new EKEvent object use this method.

    - (EKEvent *)eventWithIdentifier:(NSString *)identifier

    Make sure you keep the original EventStore object and use same EKCalendar.