我正在尝试创建谓词,但出现错误。我收到错误'NSInvalidArgumentException',原因:'无法解析格式字符串“title contains [cd] @%”'我试过这样:
request.sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"title" ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)]];
NSString *predicateString=[NSString stringWithFormat:@"title contains[cd] @% ",searchText];
request.predicate = [NSPredicate predicateWithFormat:predicateString];//error here
像这样
request.sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"title" ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)]];
request.predicate = [NSPredicate predicateWithFormat:@"title contains[cd] @%",searchText];//error here