Much thanks guys for your help 🙂
I'm stuck at another problem though.
NSMutableArray *evaluatingExpression = [anExpression copy];
if ( ! [[evaluatingExpression lastObject] isEqual:@"="] ) {
[evaluatingExpression addObject:@"="];
}
It crashes at [evaluatingExpression addObject:@"="]; saying "Program received signal: SIGART".
If this case is wrong, it crashes at another point.
for (NSString *variableObject in variables) {
if ([variableObject isEqualToString:character]) {
[workerBee setOperand: [[variables objectForKey:variableObject] doubleValue]];
break;
}
}
It crashes at if ([variableObject isEqualToString:character]) saying the same message.
Debug logs statement I noticed:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFNumber isEqualToString:]: unrecognized selector sent to instance 0x540cc00'
How NSDictionary is declared:
- (IBAction)evaluatePressed
{
[displaysetText:[NSStringstringWithFormat: @"%g", [CalculatorBrainevaluateExpression:[[selfbrain].expressioncopy]
usingVariableValues:[[NSDictionary alloc]
initWithObjectsAndKeys:
@"x", [NSNumber numberWithDouble:2],
@"a", [NSNumber numberWithDouble:4],
@"b", [NSNumber numberWithDouble:8], nil]] ]];
}
I'm pulling out my hair because of those errors..
Any help is appreciated, and thanks for those who helped me at the first error again.