iPhone Create Contact
Hey guys,
i currently am unable to create a contact within my iPhone app.
This is the code i use.
var contact = Titanium.Contacts.createPerson();
contact.firstName = companyname+' - ';
contact.lastName = shortcutname;
contact.note = shortcut;
Titanium.Contacts.save();
});
This adds a contact fine, but as soon as i add "contact.phone" the app crashes.
Anyone know the reason why?
-Tom
3 Answers
-
try
contact.phone = {'work':[PHONEP],'workFax':[FAX],'mobile':[CELL]};
-
Thats awesome, got it working now fine!
Is there anyway of setting an ID of a contact, so i can check within the app if the contact has already been added or not, to stop duplicates!
Thanks
-
Ok, here my structure in iOS, after caling the app crashes:
var contact = Ti.Contacts.createPerson({ URL : { "homepage" : 'http://vladi.de' }, phone : { "work" : ['004940330000'] }, email : { "work" : ['info@vladi.de'] }, lastName : 'Vladi Private Islands', kind : Ti.Contacts.CONTACTS_KIND_ORGANIZATION, address : { "work" : { "Street" : 'Ballindamm 7', "City" : 'Hamburg', "State" : 'Hamburg', "ZIP" : '2000' } } });
with
-[__NSCFString countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0xa0885b0
Whats going wrong?