I am using NSExpression to evaluate a mathematical string and it works great. However I want to have a way of catching an error when the input string is invalid, such as "3++2". Is there a way to go about doing this instead of the application terminating due to 'NSInvalidArgumentException'. Sorry, I am fairly new to objective-c. The code I am using now is:
NSExpression *exp = [NSExpression expressionWithFormat: string];
NSNumber *result = [exp expressionValueWithObject:nil context:nil];
answer = [result stringValue];