Project: titanium
Issue TIMOB-20013: iOS8: Ti.Contacts - relatedNames property causes crash
h5. Description: Creating a new contact with {{Ti.createContact()}} & including the {{relatedNames}} will cause the following error when build to an iOS8 Device / Sim: {code:java} [ERROR] : Script Error { [ERROR] : column = 33; [ERROR] : line = 155; [ERROR] : message = "-[__NSCFString countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x17023e340"; [ERROR] : sourceURL = ""; [ERROR] : stack = "[native code]"; [ERROR] : } {code} The same code will work successfully when build to an iOS9 Device / Sim, and removing the {{relatedNames}} property resolves the issue for iOS8. h5. Steps to reproduce: 1. Create a Classic Project. 2. Include following demo code to app.js: {code:java} var win1 = Titanium.UI.createWindow({ title:'Tab 1', backgroundColor:'#fff' });	Ti.Contacts.requestAuthorization(function(e) {	if (e.success == true) {	alert('success');	}	else {	alert('no');	}	}); var createContact = Ti.UI.createButton({	title: "Create New Contact", }); createContact.addEventListener('click',function(e){	pong = Ti.Contacts.createPerson({	firstName: 'letter',	lastName: 'pong',	middleName: 'long',	nickname: 'fancyPants',	prefix: 'Mr',	suffix: 'Jr',	firstPhonetic: 'a',	middlePhonetic: 'b',	lastPhonetic: 'c',	organization: 'appcelerator',	department: 'SDK',	jobTitle: 'pingPongChampion',	note: 'when i was young, i ping pong to the top',	kind: Ti.Contacts.CONTACTS_KIND_PERSON,	address:{	work:[	{	CountryCode: 'gb', // determines how the address is displayed	Street: '200 Brook Drive\nGreen Park',	City: 'Reading',	Country: 'England',	PostalCode: 'RG2 6UB'	},	{	CountryCode: 'gb', // determines how the address is displayed	Street: '1 St Pauls Road\nClerkenwell',	City: 'City of London',	State: 'London',	Country: 'England',	PostalCode: 'EC1 1AA'	}	],	home:[	{	CountryCode: 'gb', // determines how the address is displayed	Street: '2 Boleyn Court',	City: 'London',	State: 'Greenwich',	Country: 'England',	PostalCode: 'SE10'	}	]	},	email:{ home : [ 'myGmail', 'myHotmail' ], work : [ 'myWorkemail' ]	},	relatedNames:{	father: 'baba',	mother: 'mama',	child: 'gaga'	},	birthday: '2012-01-01T12:00:00.000+0000',	instantMessage:{	home:[	{	service: 'AIM',	username: 'leisureAIM'	},	{	service: 'MSN',	username: 'no_paul_here@msn.com'	}	],	work:[	{	service: 'AIM',	username: 'seriousAIM'	}	]	},	organization: 'Appcelerator',	phone:{	main: ['07900 000001', '07900 000002'],	iPhone: ['+44 (0)118 925 6128', '+44 (0)118 000 0000']	},	alternateBirthday: { calendarIdentifier: 'chinese', day: 25, era: 78, isLeapMonth: false, month: 11, year: 16 }, socialProfile:{	home:[{	service: 'facebook',	username: 'jdeep@facebook.com'	},	{	service: 'gamecenter',	username: 'jdeep@hotmail.com'	}],	work:[{	service: 'linkedin',	username: 'jdeep@linkedin.com'	}] },	url:{	homepage: ['www.google.com'],	work: ['www.appcelerator.com', 'www.example.com']	},	date:{	anniversary: ['2006-06-25T12:00:00.000+0000','2007-06-25T12:00:00.000+0000'],	other: ['2009-03-25T12:00:00.000+0000']	}	}); }); win1.add(createContact); win1.open(); {code} 4. Build to iOS8 device / sim 5. Receive above error. 6. Remove {{relatedNames}} property. 7. Build to IOS8 device / sim. 8. Create Contacts works successfully. h5. Result: Create Contacts will crash and return aforementioned error on iOS8. h5. Expected Result: Create contacts should work successfully on iOS8, or return a warning to exclude the relatedName property when building for iOS8.
Story points: 3