views:

53

answers:

1

Is there a way using the command line console to read a user typed value as an NSNumber, or do I have to read the input as a c-type integer and convert to a NSNumber object?

(e.g.)

NSLog(@"Enter Age:");
scanf("%d", &userAge);

gary

+5  A: 

NSNumber is actually a class, not a primitive. (Unlike, say, NSInteger which is just a typedef'ed integer or long, depending on which machine you're running.)

I think you're going to have to read it in and then do [NSNumber numberWith...]

Malaxeur