When i hit done in the edit mode of the person view controller it doesn't save to the address book. It goes to the previous screen and shows the new data. However in the contact app nothing changed.
-(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
{
ABPersonViewController *
vcPerson = [[ABPersonViewController alloc] init];
CFErrorRef error = NULL;
if([self.peopleProperty objectForKey:@"phone_number"]!=nil)
{
NSString* phoneNumber = [self.peopleProperty objectForKey:@"phone_number"];
ABMultiValueRef multiVal = ABRecordCopyValue(person, kABPersonPhoneProperty);
ABMutableMultiValueRef multiPhone = ABMultiValueCreateMutableCopy(multiVal);
ABMultiValueAddValueAndLabel(multiPhone,(__bridge CFTypeRef)(phoneNumber), kABPersonPhoneIPhoneLabel, NULL);
ABRecordSetValue(person, kABPersonPhoneProperty, multiPhone, &error);
CFRelease(multiPhone);
CFRelease(multiVal);
}
vcPerson.allowsActions = NO;
vcPerson.allowsEditing = YES;
vcPerson.displayedPerson = person;
vcPerson.personViewDelegate = self;
[vcPerson setEditing:YES animated:NO];
vcPerson.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Back",nil) style:UIBarButtonItemStylePlain target:self action:@selector(ReturnFromPersonView:)];
[self.navigationController setNavigationBarHidden:NO];
[self.navigationController pushViewController:vcPerson animated:YES];
[self dismissViewControllerAnimated:YES completion:^{
}];
return NO;}
Update I figured that apparently you cant change the value in displayed person before the view controller loads. It doesn't recognise that as a change in the contact once it tries to save later on.
I figured that apparently you cant change the value in displayed person before the view controller loads. It doesn't recognise that as a change in the contact once it tries to save later on