There are number of questions with similar title but none them of helped me.
but i can relate solution of this 'NSGenericException', reason: Collection <
In you tableview deselect method, you wrote:
for (NSString *test in updatedLocalityArray)
{
if ([test isEqualToString:tableViewCell.textLabel.text])
{
[updatedLocalityArray removeObject:test];
NSLog(@"%@ *****", updatedLocalityArray);
}
}
In that code you are enumerating through updatedLocalityArray and if you find a match you are removing that object from same array, this logic is causing the issue here. For fixing that you need to create local copy and do the changes in it and assign it back to the original array after the enumeration.
NSMutableArray *tempArray = [updatedLocalityArray mutableCopy];
for (NSString *test in updatedLocalityArray)
{
if ([test isEqualToString:tableViewCell.textLabel.text])
{
[tempArray removeObject:test];
NSLog(@"%@ *****", tempArray);
}
}
updatedLocalityArray = tempArray;