Question: 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.

Answer: 
> 
> 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];

```
For **Swift 3**

I have found out, that the issue was that I have created the store within the function that retrieves the date.

Creating the store outside of the function and using its instance solved the issue.

```
class CalendarServices: NSObject {

    var store = EKEventStore()

    func fetchEventKitCalendarEvents(date: Date, completion: @escaping (_ events: [EKEvent]?, _ error: Error?)->()) {

        let calendar = Calendar.current

        guard self.getEventKitAuthorizationStatus() == .authorized else {
            completion(nil, CoreServices.setError(message: "AuthorizationStatus != authorized"))
            return
        }

        guard let endDate = calendar.date(byAdding: .day, value: 1, to: date)  else {
            completion(nil, CoreServices.setError(message: "Error creating endDate"))
            return
        }

        CoreServices.background {

            let predicate = self.store.predicateForEvents(withStart: date, end: endDate, calendars: self.fetchEventKitCalendars())

            let events = self.store.events(matching: predicate).sorted() {
                (e1: EKEvent, e2: EKEvent) -> Bool in
                return e1.startDate.compare(e2.startDate) == .orderedAscending
            }

            CoreServices.async {

                completion(events, nil)

            }

        }

    }

}

```