Reputation: 8548
I would like to programmatically create a new reminder in my app that runs on Mavericks.
As written in the Mac Developer Library, I tried to use the method initWithAccessToEntityTypes
to initialize an event store:
On OS X, use initWithAccessToEntityTypes: instead of the default init method. Acceptable entity types are EKEntityMaskEvent for events and EKEntityMaskReminder for reminders.
However, Xcode complained that this method is deprecated in OS X 10.9.
When using it anyway, I get the following error message:
[com.apple.calendar.store.log] [Tried to connect to XPC persistence, but connection was invalidated, retrying...]
[com.apple.calendar.store.log] [Retried too many times, giving up.]
[com.apple.calendar.store.log] [Couldn't start the XPC store server. [Error Domain=CalPersistenceCreationDomain Code=3 "Could not create XPC connection to the CalendarAgent, connection interrupted or invalidated more than 5 times" UserInfo=0x6080002698c0 {NSLocalizedDescription=Could not create XPC connection to the CalendarAgent, connection interrupted or invalidated more than 5 times}]] [com.apple.calendar.agentLink.xpc] [Creating a remote proxy object for com.apple.CalendarAgent.proxy resulted in an invalid connection. The connection will be removed. Error Domain=NSCocoaErrorDomain Code=4099 "Couldn’t communicate with a helper application." (The connection to service named com.apple.CalendarAgent.proxy was invalidated.) UserInfo=0x600000475e80 {NSDebugDescription=The connection to service named com.apple.CalendarAgent.proxy was invalidated.} (
I've searched using Google, StackOverflow, and the Mac developer forums but I could not find a way to make it work.
What can I do to initialize the event store in order to add a new reminder?
Upvotes: 2
Views: 835
Reputation: 8548
The app was sandboxed. I changed the sandbox setting in Xcode (see screenshot) and now it works. Also, it seems that it is now possible to initialize a store simply by using:
self.ekEventStore = [[EKEventStore alloc] init];
Upvotes: 2