Hello,
After upgrading to macOS Sierra and Xcode 8, I receive the following errors when launching my app:
[error] warning: dynamic accessors failed to find @property implementation for 'uniqueId' for entity ABCDInfo while resolving selector 'uniqueId' on class 'ABCDInfo'. Did you remember to declare it @dynamic or @synthesized in the @implementation ?
[error] warning: dynamic accessors failed to find @property implementation for 'serialNumber' for entity ABCDAddressBookSource while resolving selector 'serialNumber' on class 'ABCDAddressBookSource'. Did you remember to declare it @dynamic or @synthesized in the @implementation ?
(And several more along the same lines.)
I figure this is because I use the AddressBook framework and that I had probably better update to use the Contacts framework instead. However, I can't get the Contacts framework working. Here is my code trying to create a CNContactStore object and get the "Me" card contact:
CNAuthorizationStatus status = [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts];
NSArray *keys = @[CNContactIdentifierKey,
CNContactGivenNameKey,
CNContactFamilyNameKey,
CNContactPostalAddressesKey,
CNContactPhoneNumbersKey,
CNContactEmailAddressesKey,
CNContactNoteKey];
if (status == CNAuthorizationStatusAuthorized)
{
NSLog (@"1a");
CNContactStore *contactStore = [[CNContactStore alloc] init];
NSLog (@"2a: %@", contactStore);
CNContact *contact = [contactStore unifiedMeContactWithKeysToFetch:keys error:nil];
NSLog (@"%@ %@", contact.givenName, contact.familyName);
}
else if (status == CNAuthorizationStatusNotDetermined)
{
NSLog (@"1b");
CNContactStore *contactStore = [[CNContactStore alloc] init];
[contactStore requestAccessForEntityType:CNEntityTypeContacts completionHandler:^(BOOL granted, NSError * _Nullable error) {
if(granted){
NSLog (@"2b: %@", contactStore);
CNContact *contact = [contactStore unifiedMeContactWithKeysToFetch:keys error:nil];
NSLog (@"%@ %@", contact.givenName, contact.familyName);
}
}];
}When I run this code, when trying to create the CNContactStore object, I receive the following error on the Console:
_block_invoke_2 (208) "Error returned from daemon: <private>"
_block_invoke_2 (208) "Error returned from daemon: <private>"
What does this mean? This error occurs twice between the 1a and 2a logs above.
Nonetheless, the 2a log shows that a CNDataMapperContactStore object is created. But calling -unifiedMeContactWithKeysToFetch on it results in a nil contact being returned, with the following error:
Error Domain=CNErrorDomain Code=200 "Updated Record Does Not Exist"
And yet I have a "me" contact in Contacts on my machine (a contact card with the little user silhouette icon next to it).
If I then try to enumerate the contactStore, I just receive a single CNContact object that is blank.
On top of this, I'm asked to authorise the app to use Contacts every time I launch it.
And, finally, when I enumerate the contactStore, I receive exactly the same errors on the Console as I did when using AddressBook anyway, which probably means my attempts to update to Contacts are pointless anyway. 🙂
[error] warning: dynamic accessors failed to find @property implementation for 'uniqueId' for entity ABCDPhoneNumber while resolving selector 'uniqueId' on class 'ABCDPhoneNumber'. Did you remember to declare it @dynamic or @synthesized in the @implementation ?
[error] warning: dynamic accessors failed to find @property implementation for 'label' for entity ABCDPhoneNumber while resolving selector 'label' on class 'ABCDPhoneNumber'. Did you remember to declare it @dynamic or @synthesized in the @implementation ?
Has anybody encountered errors like this? Am I doing to something mindnumbingly silly somewhere?
Thanks!