You have an
NSString. You want an
NSNumber. You could use
NSExpression to evaluate the string for you. However, this has a major flaw: extending it to support functions that aren't built-in to the parser requires for some awkward syntax. So if you really need
sin(), you have to jump through some intricate hoops to get it.
You could use
GCMathParser. This, however, isn't extensible at all. So if you really need
nthroot() functions, you're out of luck (unless you want to figure out how to modify the grammar and re-generate the parser).