Type Method


Returns an expression which will return the result of invoking on a given target a selector with a given name using given arguments.


+ (NSExpression *)expressionForFunction:(NSExpression *)target selectorName:(NSString *)name arguments:(NSArray *)parameters;



An NSExpression object which will evaluate an object on which the selector identified by name may be invoked.


The name of the method to be invoked.


An array containing NSExpression objects which can be evaluated to provide parameters for the method specified by name.

Return Value

An expression which will return the result of invoking the selector named name on the result of evaluating the target expression with the parameters specified by evaluating the elements of parameters.


See the description of expressionForFunction:arguments: for examples of how to construct the parameter array.

Special Considerations

This method throws an exception immediately if the selector is unknown; it throws at runtime if the parameters are incorrect.

This expression effectively allows your application to invoke any method on any object it can navigate to at runtime. You must consider the security implications of this type of evaluation.

See Also

Creating an Expression for a Function

+ expressionForFunction:arguments:

Returns a new expression that will invoke one of the predefined functions.