views:

173

answers:

2

Hello,

I am developing an app in which I have to allow user to edit the contact programatically.

I googled about it

I found that ABPersonViewController will be used. I am not able to find it how to implament it.

Address Book Programming Guide for iPhone OS also didnt work for me.

Can you suggest me the way to do it.

Thnx in advance

A: 

Ok at last i have to find the solution myself

here is it

-(IBAction)showPicker:(id) sender{
    ABAddressBookRef addressBook = ABAddressBookCreate();
    CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook);  
    ABRecordRef person = CFArrayGetValueAtIndex(allPeople,0);   
    ABPersonViewController *personController = [[ABPersonViewController alloc] init];
    personController.displayedPerson = person;
    personController.addressBook = addressBook;
    personController.allowsEditing = YES;
    personController.personViewDelegate = self;
    UINavigationController *contactNavController = [[UINavigationController alloc] initWithRootViewController:personController];
    [personController release]; 
    CFRelease(allPeople);
    CFRelease(person);

    [self presentModalViewController:contactNavController animated:YES]; 
}


-(void)personViewControllerDidCancel:(ABPersonViewController *)peoplePicker
{
    [self dismissModalViewControllerAnimated:YES];
}

-(BOOL)personViewController:(ABPersonViewController *)peoplePicker shouldPerformDefaultActionForPerson:(ABRecordRef)person property:(ABPropertyID) property identifier:(ABMultiValueIdentifier) identifier
{
    return YES;
}
Ankit Sachan
A: 

I know that time's left, but who finds this post, please look this document: http://developer.apple.com/iphone/library/documentation/ContactData/Conceptual/AddressBookProgrammingGuideforiPhone/200-QuickStart/QuickStart.html#//apple_ref/doc/uid/TP40007744-CH2-SW1

There is an updated API. It's cool.

slatvick