Search code examples
swiftmacoseventkitekeventkit

EKEventStore Requests Contacts Access on macOS


On MacOS 10.15.4, Xcode 11.4, macOS app:

Initializing an EKEventStore generates a system Contacts Access Request dialog: "“App” would like to access your contacts." I wouldn't expect this to happen as EKEventStore should only be concerned with Reminders/Calendars.

The project only contains these files modified from the defaults.

// App.entitlements

com.apple.security.app-sandbox: YES
com.apple.security.personal-information.addressbook: YES
// info.plist

NSContactsUsageDescription: "some desc"
// AppDelegate.swift

import Cocoa
import EventKit

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
    func applicationDidFinishLaunching(_ aNotification: Notification) {
        EKEventStore()
    }
}

No logs are printed to the Xcode console.

At first I suspected that this may be caused by having Shared Calendars/Reminder Lists, but it appears to happen even on accounts with no Calendars/Reminder Lists at all.

Anybody know why this may be happening?


Solution

  • I've run into the same issue as well and I've reproduced it in a minimal sample application. The problem happens when you instantiate an EKEventStore and your project has the "Address Book" entitlement as well as the "Calendars" entitlement.

    I've filed feedback with Apple (FB7757440) and they indicate that the issue is still open, but that there are less than 10 similar reports. I can only suggest that you file an issue of your own to help expedite the issue.