user826955 user826955 - 1 year ago 81
Objective-C Question

EventKitUI/EKCalendarChooser needs access to contacts - why?

I have an existing app since 2010, and with iOS 10 it is now required that the app is having strings in the

Info.plist
describing the usage, as explained here:
http://useyourloaf.com/blog/privacy-settings-in-ios-10/

However, I already added the corresponding key in my Info.plist. Still, users report app crashes when the app tries to access calendars. One of the users now managed to send me a crash report, which looks like this:

Termination Reason: TCC, This app has crashed because it attempted to access
privacy-sensitive data without a usage description.
The app's Info.plist must contain an NSContactsUsageDescription key with a string value explaining to the user how the app uses this data.
Triggered by Thread: 2

Filtered syslog:
None found

Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x00000001812501a8 0x18124f000 + 4520
1 libdispatch.dylib 0x000000018113b7ec 0x181128000 + 79852
2 Contacts 0x000000018aa2c63c 0x18a9c8000 + 411196
3 Contacts 0x000000018a9f7c40 0x18a9c8000 + 195648
4 Contacts 0x000000018aa08578 0x18a9c8000 + 263544
5 EventKitUI 0x000000018f18b5a4 0x18f169000 + 140708
6 EventKitUI 0x000000018f2a9628 0x18f169000 + 1312296
7 EventKitUI 0x000000018f2aa3a8 0x18f169000 + 1315752
8 UIKit 0x000000018843b1b4 0x1880e8000 + 3486132


Now the question is, why is my app needing access to contacts, but my app only wants to read/write calendars?

In the crashing code I am opening a
EKCalendarChooser
, and previously I asked the user for permission using
eventStore requestAccessToEntityType:EKEntityTypeEvent completion:(...)


In my Info.plist I have:

<key>NSCalendarsUsageDescription</key>


<string>Storing of leave data</string>


So how do I fix this? Must I add
NSContactsUsageDescription
as indicated by the crash report? Why? And will it lead to a popup prompt for contacts access, which would most users probably consider as a bad thing?

Note: the weirdest thing is, that on none of my devices this crash can be reproduced, I only have a couple of users reporting this kind of crash.

Answer Source

I've just had the same problem and believe it is because the EKCalendarChooser can show which of your Contacts is sharing a calendar. I just turned off all sharing including removing family members from iCloud Family and it no longer requires access to Contacts. I then tried to share a calendar with a contact using the EKCalendarChooser and it prompted for permission after I had chosen the contact.

It is a bit of a pain, but the solution is to probably go ahead and add a usage description that tells the user permission is required to show / modify calendar sharing details. Another (and more painful) alternative would be to create your own view for choosing calendars.

I'm not sure if this is intentional by Apple or a bug as I don't know if there is any way for developers to gain access to the contact information from the EKCalendarChooser view anyway.