Can't create a contact
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"]};
The trick is at the bottom of the [documentation for Contacts.Person2 regarding the structuring of the email and address objects.
-
Thank you very much !