Project: titanium
Issue TIMOB-20193: iOS: Ti.Contacts Cannot create a new entry with unsaved changes
h5. Description: *This issue also affects 5.1.1.GA* Created a test suite regarding Ti.Contacts for iOS, that creates a new group & a new person, and removes the created group. Multiple instances of the new group & person can be created in a single session, and {{removeGroup();}} can be used to remove those multiple group entries. However when trying to create a new group / person after calling {{removeGroup();}} the following error is received: {code:java} [ERROR] : Script Error { [ERROR] : column = 43; [ERROR] : line = 59; [ERROR] : message = "Cannot create a new entry with unsaved changes"; [ERROR] : sourceURL = "file:///Users/harrybryant/Library/Developer/CoreSimulator/Devices/98285102-AADF-4902-8E52-8BD0B30ED4B7/data/Containers/Bundle/Application/F6677D16-6C8A-43B3-89BA-0D14385A28F0/QE%20Automator.app/alloy/controllers/testFiles/removeGroup.js"; [ERROR] : stack = "[native code]\nfile:///Users/harrybryant/Library/Developer/CoreSimulator/Devices/98285102-AADF-4902-8E52-8BD0B30ED4B7/data/Containers/Bundle/Application/F6677D16-6C8A-43B3-89BA-0D14385A28F0/QE%20Automator.app/alloy/controllers/testFiles/removeGroup.js:59:43"; [ERROR] : } {code} the issue will persist after backgrounding the app, but terminating the app and relaunching will allow for new created entries again until {{removeGroup();}} is called. Below is a demo code of the issue in question: {code:java} var win = Ti.UI.createWindow({	backgroundColor: "White" }); var newGroup = null; var allGroups = null; var failCase = null; function testCase(){	if(failCase != null) {	return false;	} else{	return true;	} } var createPerson = Ti.UI.createButton({	title: 'Create Person 1',	top: '35%' }); createPerson.addEventListener('click', function(){	var newPerson = Ti.Contacts.createPerson({	firstName: 'Testing',	lastName: '123'	});	Ti.Contacts.save(); }); var createGroup = Ti.UI.createButton({	title: 'Create Test Group 1',	top: '20%', }); var removeGroup = Ti.UI.createButton({	title: 'Remove Test Group 1',	bottom: '20%' }); var findGroup = Ti.UI.createButton({	title: 'Find Test Group 1',	top: '50%' }); createGroup.addEventListener('click', function(){	newGroup = Ti.Contacts.createGroup();	newGroup.name = "Test Group 1";	Ti.API.info("Test Group 1 Created!");	Ti.Contacts.save(); }); removeGroup.addEventListener('click', function(){	allGroups = Titanium.Contacts.getAllGroups();	for (var i = 0; i < allGroups.length; i++) { Ti.API.info("found group name: " + allGroups[i].name); if (allGroups[i].name == "Test Group 1") { Ti.Contacts.removeGroup(allGroups[i]); Ti.API.info(allGroups[i].name + " Successfully Removed!"); failCase = null; } else {	Ti.API.info("Failed to remove group: " + allGroups[i].name);	failCase = "Not Found"; } } Ti.Contacts.save(); }); findGroup.addEventListener('click', function(){	allGroups = Titanium.Contacts.getAllGroups();	Ti.Contacts.save(); for (var i = 0; i < allGroups.length; i++) { Ti.API.info("found group name: " + allGroups[i].name); if (allGroups[i].name == "Test Group 1") { Ti.API.info('Test Group 1 Found!'); failCase = null; } else if(allGroups[i].name != "Test Group 1" || allGroups[i].name == null) {	Ti.API.info('Test Group 1 Not Found');	failCase = "Not Found"; } } }); win.add(createPerson); win.add(createGroup); win.add(removeGroup); win.add(findGroup); win.open(); {code} h5. Steps to reproduce: 1. Create a new Classic project. 2. Include demo code in app.js. 3. Build to iOS9 device / sim. 4. Tap on "Create Test Group 1" / "Create Person 1" any number of times. 5. Tap on "Remove Test Group 1" any number of times. 6. Repeat Step 4. h5. Result: Receive aforementioned error. *Additional note: Following console log is received when {{removeGroup();}} is called* {code:java} [INFO] : -[CNGroup setSnapshot:]: unrecognized selector sent to instance 0x144f26760 {code} Another ticket is written regarding this issue: https://jira.appcelerator.org/browse/TIMOB-20194 h5. Expected Result: New Group / Person should be created successfully after {{removeGroup();}} is called.
Story points: 1