I've been playing around with a search facility for my application table view for a while now trying to get it working but i keep getting the same error in my console.
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' [NSCFDictionary rangeOfString:options:]: unrecognized selector sent to instance
DataSource is an array which is taking itz value from a dictionary.... and tableData will be storing data that will be displayed in table.
Q: Suppose I have a dictionary with 5 values each having different keys corresponding to those values.. then i put that dictionary in an array. Can that array be used as a dataSource for search? and i am using the same array in cellForRowAtIndexPath to display data on my cells.
Plz suggest with code snippet.
Here is my code for textDidChange
-(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
[tableData removeAllObjects];// remove all data that belongs to previous search
NSInteger counter = 0;
for(NSString *name in dataSource)
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
NSRange r = [name rangeOfString:searchText options:NSCaseInsensitiveSearch];
if(r.location != NSNotFound)
if(r.location== 0)//that is we are checking only the start of the names.