CNContact Access - Directory Services not configured

We are trying to access the Contacts on macOS 10.14.4 Like many things that work flawlessly on iOS, much frustration on Mac!


Yes, the App has been given access in the Privacy Preferences.

Yes, Contacts are enabled in the Sandbox.

Yes, all Apple Doc has been reviewed. Most samples are 6 years old!


Here are the messages from the log:

2019-08-11 12:26:20.858611-0600 JZMac[10866:26357377] [directory-services] checking if directory services are configured

2019-08-11 12:26:20.860954-0600 JZMac[10866:26357377] [directory-services] directory services are not configured.


Thanks for any help!

John

Replies

Hi, I'm facing the same problem. I'm able to access the Contacts and fetch entries even in non-Sandboxing mode.


However I do also get the two messages.


Would also appreciate any hints

Tony

Hi Tony, We submitted a TSI and they punted to filing a Bug Report..In our experience, often a black hole.


Here is the message:


Thank you for contacting Apple Developer Technical Support (DTS). We have reviewed your request and believe this issue would be best handled by the relevant engineering team directly, as it may require changes to the OS, tools, or the frameworks you are using.

Please submit a complete bug report regarding this issue using ....


We MUST get this working so we can port our business apps which import the Contracts into the app.


Perhaps if you file a similar Bug Report it will help get some action?


Thanks!

John


Below is what we filed.


Recent Similar Reports:None


Resolution:Open


Basic Information


Please provide a descriptive title for your feedback:

CNContact Access on macOS - “Directory services are not configured” - message in xCode

Which area are you seeing an issue with?

Contacts

What type of issue are you reporting?

Application Crash


Details


What kind of contacts account is having the problem?

Something else not on this list

What kind of account?

Testing with Contacts on Mac

Which app are you using when you encounter the issue?

Something else not on this list

Which App are you using?

We are developing our macOS app.

What time was it when this last occurred? (Example: 12:00 pm EST 02/14/2018)

6:00 am on 8/15/2019


Description


Please describe the issue and what steps we can take to reproduce it:

Hello, Please note from DTS: We have reviewed your request and believe this issue would be best handled by the relevant engineering team directly, as it may require changes to the OS, tools, or the frameworks you are using.


Issue: When building and running the code below the following message is displayed in the Xcode log: 2019-08-14 12:26:20.858611-0600 JZMac[10866:26357377] [directory-services] checking if directory services are configured 2019-08-14 12:26:20.860954-0600 JZMac[10866:26357377] [directory-services] directory services are not configured. Here is the code:


- (void) loadContactList { CNAuthorizationStatus status = [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts];

if( status == CNAuthorizationStatusDenied || status == CNAuthorizationStatusRestricted) {

NSLog(@"access denied");

} else {

//Create repository objects contacts


CNContactStore *contactStore = [[CNContactStore alloc] init];

NSArray *keys = [[NSArray alloc]initWithObjects:CNContactIdentifierKey, CNContactEmailAddressesKey, CNContactBirthdayKey, CNContactImageDataKey, CNContactPhoneNumbersKey, CNContactViewController.descriptorForRequiredKeys, nil]; CNContactFetchRequest *request = [[CNContactFetchRequest alloc] initWithKeysToFetch:keys];

request.predicate = nil;

[contactStore enumerateContactsWithFetchRequest:request error:nil usingBlock:^(CNContact* __nonnull contact, BOOL* __nonnull stop) { NSString *phoneNumber = @"";

if( contact.phoneNumbers) phoneNumber = [[[contact.phoneNumbers firstObject] value] stringValue];

[self->cnArr addObject:contact]; }]; }

NSLog (@"ConImp...LoadContacts...ContArr: %lu", (unsigned long)cnArr.count);

}