EventStoreMBS.requestAccessToEntityType

I have previously used (probably a few years ago) eventStoreMBS to get access to macOS Reminders, but now the eventStore.requestAccessToEntityType always returns false for the “granted” parameter. Presumably something has changed in Mojave or Big Sur security.

I note in Apple documentation that I’m supposed to add an entitlement to com.apple.security.personal-information.calendars. I use AppWrapper4 but don’t see this as an option (there being no checkbox next to Reminders.

Am I missing something obvious?

In App Wrapper 4, the entitlement option is in Capabilities > Personal Data, just below Photos.

Also, forget about macOS Reminders synchronisation on Big Sur, it has stopped working since Catalina.

you need info.plist entries and if code signed include the right entitlement.

Yes, but there is no checkbox next to Reminders to enable it…

Screenshot 2021-06-01 at 13.42.42

If I understood correctly, you need to fill the usage description and it works. That is what I do and it works.

Yes, did that, but still not working.
I tried on a new Virtual Machine - the requestAccessToEntityType does trigger macOS to ask permission to access reminders. I can see the the app is selected inside Security & Privacy. But it is seems to be providing either granted = false or nothing when ask for eventStore.sources - I need to re-programme a bit to see which it is.

Update.
EventStore.requestAccessToEntityType is now working.

However, eventStore.sources produces an empty array (-1).

What macOS version ? What entity type (events or reminders) just to be sure I do not make a mistake ?

From Apple:

An iOS app linked on or after iOS 10.0 will crash if it doesn’t include in its Info.plist file the usage description keys for the types of data it needs to access. To access Reminders and Calendar data specifically, it must include NSRemindersUsageDescription and NSCalendarsUsageDescription, respectively.

To access the user’s Calendar data, all sandboxed macOS apps must include the com.apple.security.personal-information.calendars entitlement. To learn more about entitlements related to App Sandbox, see Enabling App Sandbox.

Seems to apply also for macOS and non sandboxed apps.

See also

Both of this are in the plist - added via AppWrapper4

This is shown in the current entitlements.

	<key>com.apple.security.app-sandbox</key>
	<true/>
	<key>com.apple.security.device.usb</key>
	<true/>
	<key>com.apple.security.files.user-selected.read-write</key>
	<true/>
	<key>com.apple.security.network.client</key>
	<true/>
	<key>com.apple.security.personal-information.addressbook</key>
	<true/>
	<key>com.apple.security.personal-information.calendars</key>
	<true/>
	<key>com.apple.security.print</key>
	<true/> 

MacOS 11.2.3, Xojo 2021 r1.1

The simple test code I am using is:

If eventStore.Available = False Then Return 

Dim ss() As EKSourceMBS = eventStore.sources

For Each s As EKSourceMBS In ss
  
  Dim i As Integer
  
Next

But the the ss() array is empty, this is run on the event EventStore.requestAccessToEntityTypeCompleted

Further info. Definitely seems to be a Sandboxing issue as the routines work fine if I turn off sandboxing.

This code above does not work for events and reminders with sandboxing on or off.

It works here after receiving the Event: EventStore.requestAccessToEntityTypeCompleted but only if sandboxing is off.

I’ve spent the morning on this - but still no closer to getting a sandboxed app to access the content of Reminders.

I did find that I need to run both the following access requests to get the app to appear in System Preferences/Privacy pane for Reminders.

type =  EKEventStoreMBS.kEntityTypeEvent
eventStore.requestAccessToEntityType(type)

type = EKEventStoreMBS.kEntityTypeReminder
eventStore.requestAccessToEntityType(type)

The app runs in both Sandboxed and non-Sandboxed versions (using AppWrapper’s script function) - both giving the same result for:

Dim r As Integer = eventStore.authorizationStatusForEntityType(Type)

Both sandbox and non-sandbox return r = 3 for both Types, ie app is authorised for access to both Events and Reminders.

However, non-Sandboxed apps return an array of ekSourceMBS’s for eventStore.sources, whereas Sandboxed apps return array(-1).

As reported earlier, the plist has the correct entitlements and descriptions for Calendars and Reminders, all generated by AppWrapper.

I have searched Apple Developer and StackExchange but not finding any useful pointers.

On Mojave ?

Big Sur

Reminders synchronisation via EventKit does not work since Catalina. It does not work either via CalDav.

Apple broke the synchronisation for third-party apps.

That’s very ungentlemenly of them!