Project: titanium
Issue TIMOB-19896: iOS: Ti.Contacts.getAllPeople() | Custom fields for phone, address and email returns undefined
When trying to show information about contacts from the iOS Contacts app which have custom field names for phone numbers or emails or address, the Ti.Contacts.Person property 'email', 'phone' or 'adress' is undefined. Which means you can't retrieve any of the emails, phone numbers or addresses (with custom field names) associated with the contact. To replicate, start iOS (version 9.x) simulator. Add a new contact, add one email address with one of the default "labels" provided by iOS, run test code (see below), the email address is listed in the console (as expected), modify the newly added person and add another email address but define a custom label to this entry, run code, the "email" property will be undefined. This can also be reproduced for the "phone" and "address" properties. Tested with Ti SDK 5.0.2.GA {code:javascript|title=Example} var win = Ti.UI.createWindow({	backgroundColor: '#fff', }); var performAddressBookFunction = function() {	var singleValue = ['firstName', 'lastName', 'fullName'];	var multiValue = ['email', 'address', 'phone'];	var people = Ti.Contacts.getAllPeople();	Ti.API.info('Total contacts: ' + people.length);	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]]));	}	} }; var addressBookDisallowed = function() {	alert('Hey! You disallowed this, why?'); }; var button = Ti.UI.createButton({	title: 'Output contacts to console',	height: 50 }); win.add(button); button.addEventListener('click', function() {	Ti.Contacts.requestAuthorization(function(e) {	if (e.success){	performAddressBookFunction();	} else {	addressBookDisallowed();	}	}); }); win.open(); {code}
Story points: 3