- Home /
Problems to register a new contact in address book
Hello,
I've been trying to use the u3DXT framework for a few days to add a new contact in to address book. I've tried several approches, but none of them worked. Here is the "best" code I have so far:
public void AddContact() {
Debug.Log ("Will add contact");
var book = ABAddressBook.Create ();
var person = ABPerson.Create ();
var firstname = new CFType(null, "Firstname");
var lastname = new CFType(null, "Lastname");
person.SetValue (ABPerson.kABPersonFirstNameProperty, firstname, null);
person.SetValue (ABPerson.kABPersonLastNameProperty, lastname, null);
book.AddRecord (person, null);
bool success = book.Save (null);
Debug.Log ("Success ?" + success);
}
This code adds a contact in the address book, but it has no info, and is registered as "No name". Am I missing something?
Hi, U3DXT is not able to add contacts or make changes to the address book yet. We have put it on our to-do list and will add this feature in future versions. ETA for this is a few weeks away. We will update with example code when we release it.
Thank you for your answer. We've found a workaround until this feature is available.
Is this a workaround in U3DXT that we don't know about? Or using something else?
We simply download the vCard. Far from best solution, obviously, but it gets the work done.
Cool. There are always more than one way to do something. Good one.