I'm trying to add an address to picked contact:
- (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker
didSelectPerson:(ABRecordRef)person{
// Adding address
ABMutableMultiValueRef addressMultipleValue = ABMultiValueCreateMutable(kABMultiDictionaryPropertyType);
NSMutableDictionary *addressDictionary = [[NSMutableDictionary alloc] init];
[addressDictionary setObject:@"8-15 Dereham Place" forKey:(NSString *)kABPersonAddressStreetKey];
[addressDictionary setObject:@"London" forKey:(NSString *)kABPersonAddressCityKey];
[addressDictionary setObject:@"EC2A 3HJ" forKey:(NSString *)kABPersonAddressZIPKey];
[addressDictionary setObject:@"United Kingdom" forKey:(NSString *)kABPersonAddressCountryKey];
[addressDictionary setObject:@"gb" forKey:(NSString *)kABPersonAddressCountryCodeKey];
ABMultiValueAddValueAndLabel(addressMultipleValue, (__bridge CFTypeRef)(addressDictionary), kABHomeLabel, NULL);
ABRecordSetValue(person, kABPersonAddressProperty, addressMultipleValue, nil);
CFErrorRef anError = NULL;
BOOL didSet;
didSet = ABAddressBookSave(_addressBook, NULL);
if (!didSet) {
NSError *er = (__bridge NSError *)(anError);
NSLog(@"Error saving record: %@", er.localizedDescription);}else{
NSLog(@"Record updated successfully");
}
CFRelease(addressMultipleValue);
}
As I see in console, there is no problem with saving it. However, when I open contact in Contacts App there is no saved address.