In titanium im accessing the phone book and i have an array with contact information (single and multi-value fields). i have troubles with the multi-value emails field. the multi-value fields stringified objects looks like this (work, home, other as well as multiple emails for work, home, etc):
email: {"work":["[email protected]","www.icloud.com"]}
phone: {"work":["(555) 766-4823"],"other":["(707) 555-1854"]}
the code i have so far:
function buddy_check(){
var all_emails= []; // array of emails from senders contacts
var multiValue = ['email'];
var people = Ti.Contacts.getAllPeople(); // gets all contacts (recordId, name,…)
for (var i=0, ilen=people.length; i<ilen; i++){
Ti.API.info('---------------------');
var person = people[i];
//for (var j=0, jlen=singleValue.length; j<jlen; j++){
// Ti.API.info(singleValue[j] + ': ' + person[singleValue[j]]);
// }
for (var j=0, jlen=multiValue.length; j<jlen; j++){
Ti.API.info(multiValue[j] + ': ' + JSON.stringify(person[multiValue[j]]));
all_emails.push();
}
}
i need all emails of the phone book in one array, separated by comma. underscore functions would work as well.
what do i have to push to the all_emails array? is there a simpler way to extract the emails and put it in an array (e.g search for "@")?
thx for sharing insights!
P.S: the user is of course informed that the emails are being checked with our database.
from here: http://www.oodlestechnologies.com/blogs/How-to-extract-contact-list-having-phone-numbers-and-emails-from-iPhone-contacts-using-Titanium
- See more at: http://www.oodlestechnologies.com/blogs/How-to-extract-contact-list-having-phone-numbers-and-emails-from-iPhone-contacts-using-Titanium#sthash.q7TJF8Lg.dpuf