How can I convert a NSString containing a number of any primitive data type (e.g. int, float, char, unsigned int
NSString
int
float
char
unsigned int
Try this
NSNumber *yourNumber = [NSNumber numberWithLongLong:[yourString longLongValue]];
Note - I have used longLongValue as per my requirement. You can also use integerValue, longValue, or any other format depending upon your requirement.