Project: titanium
Issue TIMOB-20152: iOS: Contacts.getPeopleWithName not returning multi-value fields correctly
h5. Description: Whilst working on an automated test for {{Ti.Contacts.Person}} properties, an issue was found when attempting to retrieve the properties using {{Ti.Contacts.getPeopleWithName}}. fields with single string values were returned as intended, however fields with arrays such as {{email}} do not return the correct value (i.e. {{[object Object]}} or an error with be thrown using the following code: {{Ti.API.info("person: " + person.email.home[0]);}} ) However, a workaround to this issue is to use the method {{Ti.Contacts.getPersonByIdentifier}} , which correctly returns fields with array values. Confirmed that this is *not* a regression. h5. Steps to reproduce: 1. Create a new Classic project. 2. use demo code: {code:java} var win1 = Titanium.UI.createWindow({ title:'Tab 1', backgroundColor:'#fff' }); var saveID = ""; var Ncook = new Object(); Ncook.firstName = "Nathaniel"; Ncook.lastName = "Cook"; Ncook.middleName = "John"; Ncook.nickname = "Fish"; Ncook.prefix = "Mr"; Ncook.suffix = "III"; Ncook.firstPhonetic = "N"; Ncook.middlePhonetic = "T"; Ncook.lastPhonetic = "A"; Ncook.organization = "appcelerator"; Ncook.department = "Cloud"; Ncook.jobTitle = "QE"; Ncook.note = "You gotta risk it, to get the biscuit"; Ncook.email = { home : [ 'myGmail', 'myHotmail' ], work : [ 'myWorkemail' ]	}; // Ncook.address = ""; // Ncook.phone = ""; // Ncook.instantMessage = ""; // Ncook.relatedNames = ""; // Ncook.date = ""; // Ncook.url = ""; var singleValue = [ 'firstName', 'lastName', 'middleName', 'nickname', 'prefix', 'suffix', 'firstPhonetic', 'middlePhonetic', 'lastPhonetic', 'organization','department', 'jobTitle', 'note' ]; var multiValue = [ 'email', 'address', 'phone', 'instantMessage', 'relatedNames', 'date', 'url' ]; newNathan = Ti.UI.createButton({	title: "New Nathan",	top: '20%' }); newNathan.addEventListener('click', function(){	var newCook = Ti.Contacts.createPerson(Ncook);	// saveID = newCook.getIdentifier();	// Ti.API.info(saveID); }); button2 = Ti.UI.createButton({	title: "Compare Nathan",	top: '40%' }); button2.addEventListener('click', function(){	var people = Ti.Contacts.getPeopleWithName("Nathaniel"); // var people = Ti.Contacts.getPersonByIdentifier(saveID); Ti.API.info('Total contacts: ' + people.length); var person = people[0]; // var person = people; Ti.API.info("Ncook: " + Ncook.email.home[0]); Ti.API.info("person: " + person.email); //Ti.API.info("person: " + person.email.home[0]); Ti.API.info("person: " + person.lastName); Ti.API.info("-----------------------------------------"); for (var j=0, jlen=singleValue.length; j
Story points: 5