0

I'm trying to access the ContactStore of MacOS App, did the following implementation

public void Contacts()
{
    //Starting
    var store = new CNContactStore();

    store.RequestAccess(CNEntityType.Contacts, async (bool granted, NSError error) =>
        {
            if (granted)
            {
                //Query things
            }
        });
}

The thing is that the Authorize screen never popup, and the Permission always say denied.

If I go to settings to remove that record, the app is not there.

Can someone please point me to the light?

CSDev
  • 3,177
  • 6
  • 19
  • 37

1 Answers1

1

It works for me with those two lines:

            var contactStore = new CNContactStore();
            var status = CNContactStore.GetAuthorizationStatus(CNEntityType.Contacts);

It could be also that you need to set NSContactsUsageDescription in info.plist.

Ivan Ičin
  • 9,672
  • 5
  • 36
  • 57
  • Was missing the NSContactsUsageDescription on the info.plist, strange that is not that clear in the documentation found over the internet regarding CNContactStore, this solved the issue Thanks Ivan! – Starlin González Jul 26 '19 at 10:38