i have NSDictionary with with key and its value and i want it to populate into the tableview but i get some error like this:
-[__NSArrayM isEqualToString:]: unrecognized selector sent to instance 0x8f8e4d0
2014-08-13 13:29:45.357 SotaApp[1602:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM isEqualToString:]: unrecognized selector sent to instance 0x8f8e4d0'
what i have tried is:
NSString *value = [filteredDictionaryValues valueForKey:[filteredDictionaryValues.allKeys objectAtIndex:indexPath.row]];
cell.textLabel.text =[filteredDictionaryValues.allKeys objectAtIndex:indexPath.row];
cell.detailTextLabel.text = value;
Please tell me whats the problem, thank you.
EDIT the dictionary looks like this:
activity = (
"0Pharmacology.html"
);
acute = (
"0Pharmacology.html"
);
adenosine = (
"0Guidelines Precautions.html"
);
administration = (
"0Guidelines Precautions.html"
);
aneurysm = (
"0Dilution for Infusion.html"
);
arrhythmias = (
"0Guidelines Precautions.html"
);
artery = (
"0Dilution for Infusion.html"
);
asthma = (
"0Guidelines Precautions.html"
);
atrium = (
"0Dosing.html"
);
I have filtered the dictionary from search method:
-(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{
if (searchText.length == 0) {
isSearching = NO;
}
else{
isSearching = YES;
}
NSPredicate *predicate =[NSPredicate predicateWithFormat:@"self beginswith[c] %@",searchText];
NSArray *filteredKeys =[[myDictionary allKeys]filteredArrayUsingPredicate:predicate];
NSLog(@"filtered keys are %@",filteredKeys);
filteredDictionaryValues =[myDictionary dictionaryWithValuesForKeys:filteredKeys];
NSLog(@"filteredDicValues are %@",filteredDictionaryValues);
[self.SerchTable reloadData];
}
See Question&Answers more detail:os