I was going to write a post about how casting integers as strings is easy in Flex and hard in Objective-C, but who am I kidding? It’s easy in both.

In general, you’ll probably be dealing mostly with ints (primitives) and NSNumber objects in your code:

NSNumber *myNumber;
int myInt;


So how do you cast them as strings?

NSString *myNumberString = [myNumber stringValue];
NSString *myIntString = [[NSNumber numberWithInt:myInt] stringValue];


Easy, right? The only real trick is you have to convert an int to an NSNumber object before you cast it as a string.