Reading Security & Privacy prefs

Hello,

Does someone know how to read the setting for an application in System Preferences -> Security & Privacy -> Privacy -> Contacts -> [the application]

I want to know if it is listed, and if so, if it is ckecked or unchecked.

Thanks in advance!
Tips on how to do this with the MBS-plugins are also welcome.

Marc Vos

I don’t think there is a way to check, but apparently if you request the sharedAddressBook it will return Nil if you don’t have access, otherwise you will get the sharedAddressBook…

If I do that, MacOS comes with a dialog ‘The application wants to access your contacts’ every time one presses ‘Cancel’. Some people do, you know.

So, to prevent this, I was thinking about a pre-check and pop-up my own dialog and set a preference in my app.

Now that I think about it, I can do the same when I don’t get access. Pop-up a dialog after the user presses ‘Cancel’ and store this in a pref-setting. Although I like the pre-check more.

Marc

Looks like what you want to do can be done through the new Contacts framework (which replaces the AddressBook framework)…

https://developer.apple.com/reference/contacts/cncontactstore/1403143-authorizationstatusforentitytype?language=objc

Christian, you got something for this? :wink:

nice find but beware it only works after 10.11

ahh… yes, I forgot to mention that, but the Contacts framework, is the new one that works on all of Apple’s devices…

You can use MBS Plugin for Contacts.

New framework (64-bit only)
http://www.monkeybreadsoftware.net/pluginpart-contacts.shtml

Old framework (32 & 64-bit)
http://www.monkeybreadsoftware.net/pluginpart-abaddressbook.shtml

Christian, took you long enough to post… Did you have to code the plugin? :wink:

I was traveling this week and had a limited time to check forum.

hehe… Just teasing ya… I didn’t know MBS could do the new Contacts otherwise I would have mentioned it… :slight_smile: