json 応答から製品のリストをフィルター処理しようとしています。左側の式「ステータス」の右側には、ドロップダウンが必要です。だから正しい表現を使った。nspredicate を使用してこの json をフィルタリングしている間、スペースが原因で機能しません。これに到達するのを手伝ってください。
NSArray *Mainarray;// Suppose this contains the response as "status"="Checked In" for 1 product and for other product "status"="Lost/Missing"
NSArray *left=@[[NSExpression expressionForKeyPath:@"status"]];
NSArray *right=@[[NSExpression expressionForKeyPath:@"Awaiting inputs"],[NSExpression expressionForKeyPath:@"Checked In"],[NSExpression expressionForKeyPath:@"Checked out"],[NSExpression expressionForKeyPath:@"Lost/Missing"],[NSExpression expressionForKeyPath:@"xxx Testing/Primary System"],[NSExpression expressionForKeyPath:@"Sold To"],[NSExpression expressionForKeyPath:@"closed"],[NSExpression expressionForKeyPath:@"Used for Parts"]];
NSArray *operators= @[@(NSEqualToPredicateOperatorType),@(NSNotEqualToPredicateOperatorType)];
NSArray *compoundTypes = @[@(NSAndPredicateType),@(NSOrPredicateType),@(NSNotPredicateType)];
NSPredicateEditorRowTemplate *template;
template=[[NSPredicateEditorRowTemplate alloc]initWithLeftExpressions:left rightExpressions:right modifier:NSDirectPredicateModifier operators:operators options:(NSCaseInsensitivePredicateOption | NSDiacriticInsensitivePredicateOption)];
compoundtemp = [[NSPredicateEditorRowTemplate alloc] initWithCompoundTypes:compoundTypes];
[predicateEditor setRowTemplates:@[template,compoundtemp]];
NSPredicate *predicate=[predicateEditor predicate];
NSArray *resultArray=[Mainarray filteredArrayUsingPredicate:predicate];