Iphone 在ABRecordRef中以数组形式添加所有人员

Iphone 在ABRecordRef中以数组形式添加所有人员,iphone,Iphone,如何将联系人中的人员添加到“人员”数组,然后添加到abrecordref。???事实上,我想在tableview中的所有联系人,可以编辑个人记录。这是我的密码: -(void)showPersonViewController { // Fetch the address book ABAddressBookRef addressBook = ABAddressBookCreate(); // Search for the person nam

如何将联系人中的人员添加到“人员”数组,然后添加到abrecordref。???事实上,我想在tableview中的所有联系人,可以编辑个人记录。这是我的密码:

-(void)showPersonViewController
{      
    // Fetch the address book 
        ABAddressBookRef addressBook = ABAddressBookCreate();
        // Search for the person named "rubal" in the address book
        NSArray *people = (NSArray *)ABAddressBookCopyPeopleWithName(addressBook, CFSTR("naina"));
        // Display "KETAN" information if found in the address book 
        if ((people != nil) && [people count])
        {
            ABRecordRef person = (ABRecordRef)[people objectAtIndex:0];
            ABPersonViewController *picker = [[[ABPersonViewController alloc] init] autorelease];
            picker.personViewDelegate = self;
            picker.displayedPerson = person;
            // Allow users to edit the person’s information

            picker.allowsEditing = YES;
            [self.navigationController pushViewController:picker animated:YES];
        }
        else 
        {
            // Show an alert if "KETAN" is not in Contacts
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" 
                                                      message:@"Could not find naina in the Contacts application" 
                                                      delegate:nil 
                                                  cancelButtonTitle:@"Cancel" 
                                              otherButtonTitles:nil];
            [alert show];
            [alert release];
         }
           [people release];
           CFRelease(addressBook);
}

我希望表视图中的所有记录都单独编辑,而不仅仅是“naina”

查看ABPerson类引用。还有一个其他复制函数的列表,包括您正在寻找的函数,
abAddressBookCopyArrayFallPeople(ABAddressBookRef ab)
注释掉您的函数并添加此函数,看看它是否有效

-(BOOL)peoplePickerNavigationController:
(ABPeoplePickerNavigationController *)peoplePicker
shouldContinueAfterSelectingPerson:(ABRecordRef)person {


            [peoplePicker dismissModalViewControllerAnimated:NO];

            ABPersonViewController *picker = [[ABPersonViewController alloc] init];
            picker.personViewDelegate = self;
            picker.displayedPerson = person;

// Allow users to edit the person’s information
            picker.allowsEditing = YES;
            [picker setValue:[NSNumber numberWithBool:YES] forKey:@"allowsDeletion"];



            [self.navigationController pushViewController:picker animated:YES];

    return YES;
}