I'm trying to write a little directory lookup app that allows you to save contacts you find to your Address Book. I am only working in the simulator for now, with SDK 1.0.
I am able to create a new entry in the Address Book and set the first and last name on it. However, when I try to add email OR phone information to the record, the save() method freezes for a moment and crashes the simulator (infinite loop, perhaps?).
var contact = Ti.Contacts.createContact(); contact.firstName = e.row.firstname; contact.lastName = e.row.lastname; contact.email = e.row.email; contact.phone = e.row.phone; contact.save();
I've dumped e.row.email and e.row.phone to make sure they were set properly; these are the formats I'm using:
e.row.email = 'firstname.lastname@example.org'; e.row.phone = '(512) 555-1212';
Note that setting either of these will cause the crash.
Contacts API is not yet ready for prime time. It should be by the 1.2 release in a couple of weeks.