I have a UITextField, which I am trying to use a NSNumberFormatter with a NSNumberFormatterDecimalStyle to convert the text field into an NSNumber to initialise an object.

However when I do this, I can't get any sensible results out of the conversion. For the purpose of this example I have replaced the UITextField with a string, but I still get strange results. I am sure I am doing something daft, but any help would be appreciated.

```
//NSString * boardNumberText = self.txtBoardNumbs.text;
NSString * boardNumberText = @"42";

NSNumberFormatter * formatter = [[NSNumberFormatter alloc] init];
[formatter setNumberStyle:NSNumberFormatterDecimalStyle];

NSNumber * boardNumber = [formatter numberFromString:boardNumberText];

if ([boardNumber isEqual:nil]) {
    NSLog(@"Number was null");
}
NSLog(@"Number was not null");

[self.board setNumber:boardNumber];

NSLog(boardNumberText);
NSLog([NSString stringWithFormat:@"%d", boardNumber]);
NSLog([NSString stringWithFormat:@"%d", self.board.number]);

```

The output that I get from the log file when I run this is:

```
2012-07-15 16:54:26.564 CoreDataDev[16123:fb03] Number was not null
2012-07-15 16:54:26.564 CoreDataDev[16123:fb03] 42
2012-07-15 16:54:26.565 CoreDataDev[16123:fb03] 135821152
2012-07-15 16:54:26.565 CoreDataDev[16123:fb03] 135820272

```