1
votes

ABPersonViewController is not opening in editable mode. When I use break point then control is not reaching the delegate method. Where is the problem? Here is my code:


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    // Fetch the address book 
    if ((people != nil) && [people count])

    {   ABAddressBookRef addressBook = ABAddressBookCreate();
        //ABPersonViewController *personController = [[ABPersonViewController alloc] initWithNibName:@"ABPersonViewController" bundle:nil];

        ABRecordRef person = (ABRecordRef)[people objectAtIndex:indexPath.row];     
        ABPersonViewController *personController = [[[ABPersonViewController alloc] init]autorelease];

        personController.addressBook = addressBook;
        personController.personViewDelegate = self;
        personController.displayedPerson = person;
        personController.allowsEditing = YES;       
        //navigationController = [[UINavigationController alloc] init] ;
        [self presentModalViewController:personController animated:YES];
        //[self.navigationController pushViewController:personController animated:YES];
        //[personController release];   
    }   
    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];

}



- (BOOL)personViewController:(ABPersonViewController *)personViewController shouldPerformDefaultActionForPerson:(ABRecordRef)person 
                    property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifierForValue
{
    return NO;
}
1

1 Answers

0
votes

You're on the right track regarding editable mode. However, you first need to push the ABPersonViewController from a navigation controller (see documentation)