Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EKEvent eventIdentifier returns null

When I try to get the identifier of an EKEvent, all I get is a nil value. Since in iOS5 EKEvent is a subclass of EKCalendarItem, I figured I might be able to get the EKCalendarItem's UUID, but that returns nil as well.

Every now and then I also get this error while trying to access the identifier or UUID property:

CADObjectGetInlineStringProperty failed fetching uniqueID for EKPersistentEvent with error Error Domain=NSMachErrorDomain Code=268435459 "The operation couldn’t be completed. (Mach error 268435459 - (ipc/send) invalid destination port)"

I've been stuck on this problem for quite some time now, but figured it would be iOS5 beta related. But since we're now at iOS5, it's still not working.

like image 702
Glenn Avatar asked Oct 14 '11 14:10

Glenn


3 Answers

In my app I found out that if you ask for the eventIdentifier when the eventStore that fetched it has been released, it returns nil. But if you ask for the eventIdentifier before it will return the id ok. You can then release the EKEventStore instance and ask for the identifier with no problem.... Seems that it needs the eventStore to retrieve the id, but I get no warnings.

like image 51
the Reverend Avatar answered Sep 22 '22 10:09

the Reverend


When I try to get the identifier of an EKEvent, all I get is a nil value

Try to save AND commit your event before retrieving the identifier :

[eventStore saveEvent:event span:EKSpanThisEvent commit:YES error:&err];
NSString *strId = [[NSString alloc] initWithFormat:@"%@", event.eventIdentifier];
like image 45
SpecialK Avatar answered Sep 18 '22 10:09

SpecialK


eventIdentifier is set when the event is added to the EKEventStore. If you try to access this value before adding it, it would return null.

like image 42
Aditi Avatar answered Sep 21 '22 10:09

Aditi