Swift 4.0 Eventkit Cannot get calendars and events correctly

后端 未结 3 585
后悔当初
后悔当初 2021-02-06 14:55

I\'m trying to use Eventkit to access Mac Calendar. Access is successfully requested but I keep getting nil or an empty array of calendar or events, even though I have several c

3条回答
  •  旧时难觅i
    2021-02-06 15:17

    After lots of trial and error, I found the answer.

    You need to set the com.apple.security.personal-information.calendars key to YES in your entitlements file, even if your app is not sandboxed. There is a bug in Apple's implementation of EventKit that prevents your app getting access to calendars if it does not set this key, even if the sandbox is disabled.

提交回复
热议问题