The text
of a text field will ALWAYS be a NSString
since that is how the class was designed.
Your task, then, is to convert it into a NSNumber
. The best way to do this is to use a number formatter like this:
NSNumberFormatter *formatter = [NSNumberFormatter new];
self.weight = [formatter numberFromString:self.textArea.text];
if (!self.weight) {
// No valid number was found.
}