0

I have looked all over SO and elsewhere and I suppose what I am trying to do is not possible. I am wondering if its possible to use ABNewPersonViewController to create a person and save it locally (i.e. not in the address book but as a file). Or if anyone knows of an open source library to accomplish that.

Currently I am writing it a similar class from scratch to populate a person object that I have also manually created...but I am wondering if I am recreating the wheel.

JeffN
  • 1,535
  • 15
  • 26

1 Answers1

2
- (void)newPersonViewController:(ABNewPersonViewController *)newPersonView didCompleteWithNewPerson:(ABRecordRef)person;
{
    if (person) {
        ABAddressBookRef addressBookRef = ABAddressBookCreateWithOptions(NULL, nil);
        BOOL result = ABAddressBookRemoveRecord (addressBookRef,person,NULL);
        if (result) {
            BOOL save = ABAddressBookSave(addressBookRef, NULL);
            if (save) {
                NSLog(@"remove successfully");
            }
        }
    }
    [self.navigationController popViewControllerAnimated:YES];
}

And extract information from person and save them as NSStrings,make a NSDictionary, then you are able to save the dictionary to a file as it is a property-list object.

gabbler
  • 13,128
  • 4
  • 29
  • 41