Search code examples
iphoneiosobjective-cxcodeddmathparser

No visible @interface for 'DDExpression' declares the selector 'evaluateWithSubstitutions:error:' error


I have an array which I want to validate: {"2","+","3","=","5"}

So how would I do it? I found DDMathParser and theoretically I would be able to validate my expression like so:

NSString *expression = [array componentsJoinedByString:@""];


NSError *error = nil;
DDExpression *e = [DDExpression expressionFromString:expression error:&error];
if (error == nil) {
    NSLog(@"parsed: %@", e);
    NSNumber * result = [e evaluateWithSubstitutions:expression error:&error];
    //error: No visible @interface for 'DDExpression' declares the selector 'evaluateWithSubstitutions:error:' 
}

Any thoughts why? I must mention this method is inside my singleton but when I moved it to my view controller error stayed.


Solution

  • Assuming you are using this project (GiHub link), I did not see a method evaluateWithSubstitutions:error:.

    From the GitHub project, it looks like the full method signature is (source, line 33):

    - (NSNumber *) evaluateWithSubstitutions:(NSDictionary *)substitutions evaluator:(DDMathEvaluator *)evaluator error:(NSError **)error;