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);
}