Note that there are some explanatory texts on larger screens.

plurals
  1. POsearchDisplayController does not display results if the iphone language is non English
    primarykey
    data
    text
    <p>I have a <code>searchDisplayController</code> which works perfectly when searching for English and Arabic words using a method as follows:</p> <pre><code>- (void)filterContentForSearchText:(NSString*)searchText scope:(NSInteger)scope { NSString *query = self.searchDisplayController.searchBar.text; if (query &amp;&amp; query.length) { NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ClientName contains[cd] %@", query]; [searchResultController_.fetchRequest setPredicate:predicate]; } NSError *error = nil; if (![[self searchResultController] performFetch:&amp;error]) { // Handle error NSLog(@"Unresolved error %@, %@", error, [error userInfo]); exit(-1); // Fail } } </code></pre> <p>However, this works fine if the iphone language is English, but if I change the iPhone language to Arabic (global settings) and tried to search in Arabic or English words the <code>searchResultsController</code> will not display results, why ?</p> <p>p.s. when I put a static Arabic word in query like this: <code>NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ClientName contains[cd] %@", @"تجريب"];</code> the <code>searchDisplayController</code> will display the correct result of the arabic word <code>تجريب</code></p> <p>EDIT: I've tried to build the predicate in code like this :</p> <pre><code> NSExpression *clientNameEx=[NSExpression expressionForKeyPath:@"ClientName"]; NSExpression *aClientEx=[NSExpression expressionForConstantValue:query]; NSPredicate *predicate=[NSComparisonPredicate predicateWithLeftExpression:clientNameEx rightExpression:aClientEx modifier:NSDirectPredicateModifier type:NSContainsPredicateOperatorType options:0]; </code></pre> <p>but to no avail ...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload