I created a test project with Xcode 4, MasterDetail template, CoreData. Enabled and added the SearchBarController to the standard core views, added the UISearchBarDelegate delegate to the header, and clicked on the searchBarTextDidEndEditing method to invoke the search query.
-(void)searchBarTextDidEndEditing:(UISearchBar *)searchBar{ [NSFetchedResultsController deleteCacheWithName:nil]; self.fetchedResultsController = nil; [self.tableView reloadData]; }
The final step was to add to fetchedResultsController:
NSString *query = self.searchDisplayController.searchBar.text; if (query.length) { NSPredicate *predicate = [NSPredicate predicateWithFormat:@"timeStamp contains[cd] %@", query]; NSLog(@"predicate %@", [predicate description]); [fetchRequest setPredicate:predicate]; }
I turned on the Simulator iPhone and tested it with the iOS5 and Arabic settings. All search queries that successfully search for the word "test" and the word "تجريب" produce results. However, the word "تجريب" was copied from your question, as my arabica is a little rusty :). I also tried to make a record in the database with the first letter on the Arabic keyboard, and then search for it and get the result.
source share