Search code examples
iphoneabaddressbook

How to delete one number of iphone contact which has multiple numbers in the contact?


I want to delete contact of iphone manually(with number by number). Can anyone help me to do the same. I have done with deleting contact using method

ABAddressBookRemoveRecord(addressBook, record, nil);

This method makes me to delete a single contact with all of its record but I want to do delete manually means want to delete single number of the existing contact if it has multiple numbers. The given image says the requirement.

This image says the requirement


Solution

  • You Can refer following links which will be helpful to you......

    http://www.xprogress.com/post-56-best-example-of-how-to-add-entry-to-contacts-using-addressbookui-framework-on-iphone-sdk/

    http://www.modelmetrics.com/tomgersic/iphone-programming-adding-a-contact-to-the-iphone-address-book/

    iOS - add contact into Contacts?

    With the help of these links you can know to add contact to iphone OS programatically...

    To resolve this problem you have to get the existing contact object(ABRecordRef object) which you have to update ,get the number property label object which contains all the numbers,remove the number which u want to delete from the ABMutableMultiValueRef of the numbers which u have to prepare.Then after doing all the stuffs... use following code...

    ABRecordSetValue(person, kABPersonPhoneProperty, multiPhone,nil);
    

    Then save the addressbook using following code....

    ABAddressBookSave(iPhoneAddressBook, &error);
    

    This code is on the basis of my R&D, try this it must work....Thanks!!!