You can fake your request, perhaps as simple as
NSArray *tokens = [querystring componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
Then we construct a compound predicate.
NSMutableArray *predarray = [NSMutableArray array]; for(NSString *token in tokens) { NSPredicate *predicate = [NSPredicate predicateWithFormat:@"Any name CONTAINS[cd] %@",token]; [predarray addObject:predicate]; } NSPredicate *final = [NSCompoundPredicate andPredicateWithSubpredicates:predarray];
And send it to your request
In real life, I will conduct several checks against each token to check its ability to make a valid predicate and not crash or create a security risk. for example Use special characters like "* []"
EDIT . The type of predicate for working with a situation has been fixed.
source share