I am trying to automatically add contact to the iOS address book from my app, where the name of the contact is from a NSString. I have tried to figure it out (see code under), but It didn't work. It works to add contacts with the first code I have provided (I have the save code and stuff), but I would like to add contact from string that may vary, not just a name that can't.
ABRecordRef newPerson = ABPersonCreate();
ABRecordSetValue(newPerson, kABPersonFirstNameProperty,@"Davis11", &error);
ABRecordSetValue(newPerson, kABPersonLastNameProperty, @"Scott", &error);
I have also tried this code, with no luck:
ABRecordRef newPerson = ABPersonCreate();
ABRecordSetValue(newPerson, kABPersonFirstNameProperty,fName, &error);
ABRecordSetValue(newPerson, kABPersonLastNameProperty, lName, &error);