NSPredicateEditorRowTemplate() gives syntax error "Type of expression is ambiguous without more context"

33 views Asked by At

I fail in creating a NSPredicateEditorRowTemplate

func predicator() -> NSPredicateEditorRowTemplate {
        let monthList = [NSExpression(forConstantValue:1),NSExpression(forConstantValue:2), NSExpression(forConstantValue:3) ]
        
        let leftExp = NSExpression(forKeyPath:"monthP")
        
        let monthTemplate = NSPredicateEditorRowTemplate (
            leftExpressions: leftExp,
            rightExpressions: monthList,
            modifier: NSComparisonPredicate.Modifier(rawValue: 0),
            operators: NSNumber(value:4),
            options: 0)
        return monthTemplate
    }

When the code gets compiled, I receive the error message:

"Type of expression is ambiguous without more context"

I checked , if I have missed an argument, and if arguments are typed correctly. All seems ok. I even used the code completion help to avoid mistyping arguments.

No idea what could be wrong. Does anyone see the problem ?

0

There are 0 answers