I know I am probably missing something pretty basic here, but I am trying to convert a number entered on a UITextField from a NSString into a NSNumber as follows:
self.currentServer.port = [NSNumber numberWithInt:[addressPortTextField.text doubleValue]];
NSLog(@"Port: %@ / %@", addressPortTextField.text, self.currentServer.port);
The number in self.currentServer.port is 50000
The NSLog shows the following:
Port: 50000 / -15536
I don't get what I am doing wrong here? I've tried with doubleValue, intValue, integerValue.
* I found the Problem **
self.currentServer.port is a coredata field of type Integer16. 50000 is to large for that field size, I updated the database to Integer32 and all is well now.