Can't create a contact

You must Login before you can answer or comment on any questions.

Hello,

I try to create a contact on my iPhone app, like this:

var contact = Titanium.Contacts.createPerson();
    contact.firstName = 'foo;
    contact.lastName = 'foo';
    contact.email = 'foo@foo.com';
    // contact.email.home = 'test@gmail.com'; //doesn't work too
    // contact.email = {"home": 'test@gmail.com'};//doesn't work too
    // contact.email = {home: 'test@gmail.com'};//doesn't work too
    // contact.email = {label: 'home', value: 'test@gmail.com'};//doesn't work too
    contact.organization = 'my organization';
    contact.jobTitle = '-';
    contact.phone = '321434343'; // crash the app, too
 
    Titanium.Contacts.save();
How create a contact with a firstname, lastname, email and address ?

Thanks!

2 Answers

Accepted Answer

There was not a complete example in Kitchen Sink, but I figured it out

contact.email = {"home": ["test@gmail.com"]};

Here is a complete solution

The trick is at the bottom of the [documentation for Contacts.Person[2] regarding the structuring of the email and address objects.

Your Answer

Think you can help? Login to answer this question!