-1

当我在人员视图控制器的编辑模式下点击完成时,它不会保存到地址簿。它转到上一个屏幕并显示新数据。但是在联系人应用程序中没有任何改变。

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

更新 我想显然你不能在视图控制器加载之前更改显示的人的值。一旦稍后尝试保存,它就不会将其识别为联系人的更改。

4

1 回答 1

0

我认为显然你不能在视图控制器加载之前更改显示的人的值。一旦稍后尝试保存,它就不会将其识别为联系人的更改

于 2013-04-16T08:09:57.040 回答