Now I’m trying to modify and save ‘dates’ field of an existing contact. Though the following script doesn’t spit errors but nothing happens to the contact. Could anybody help?
```
from objc_util import *
ObjectiveC contacts
CNContactStore = ObjCClass('CNContactStore').alloc().init()
CNContact = ObjCClass('CNContact')
Containers = CNContactStore.containersMatchingPredicate_error_(None,None)
for Container in Containers:
id = Container.identifier()
predicate = CNContact.predicateForContactsInContainerWithIdentifier_(id)
# keys not exactly like in Apple doc
predicate_contacts = CNContactStore.unifiedContactsMatchingPredicate_keysToFetch_error_(predicate, ['familyName', 'givenName', 'middleName', 'dates'], None)
'''
print('First name: ', end='')
first_name = input()
print('Last name: ', end='')
last_name = input()
'''
first_name = 'Ludwig'
last_name = 'Beethoven'
for contact in predicate_contacts:
if first_name == str(contact.givenName()) and last_name == str(contact.familyName()):
break
CNMutableContact = contact.mutableCopy()
dateComponents = ObjCClass('NSDateComponents').alloc().init()
label = 'passing'
dateComponents.day = 26
dateComponents.month = 3
dateComponents.year = 1827
'''
print('Label: ', end='')
label = input()
print(label.capitalize()+' year: ', end='')
dateComponents.year = int(input())
print(label.capitalize()+' month: ', end='')
dateComponents.month = int(input())
print(label.capitalize()+' day: ', end='')
dateComponents.day = int(input())
'''
CNLabeledValue=ObjCClass('CNLabeledValue')
value=CNLabeledValue.alloc()
value.initWithLabel_value_(label, dateComponents)
CNMutableContact.dates=[value]
CNSaveRequest = ObjCClass('CNSaveRequest').new().autorelease()
CNSaveRequest.updateContainer_(CNMutableContact)
CNContactStore.executeSaveRequest_error_(CNSaveRequest, None) ```