Description:
When calling
removeGroup();
the following message is received in the console:
[INFO] : -[CNGroup setSnapshot:]: unrecognized selector sent to instance 0x144f26760
This does not cause an error, and groups are successfully removed, however this may be worth investigating.
Demo Code:
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();
Steps to reproduce:
1. Create a new Classic Project.
2. Use demo code provided above in app.js.
3. Tap on "Create Test Group 1"
4. Tap on "Remove Test Group 1"
5. Observe console for message.
Result:
Receive:
[INFO] : -[CNGroup setSnapshot:]: unrecognized selector sent to instance 0x144f26760
Expected Result:
Should not receive following console message.
Duplicate of TIMOB-20193
Closing ticket as duplicate with reference to the linked issues.