i don't really understand why this isn't working:
Code:
int randomNumber = (random() % 25000);
NSString *pathName = (@"/tmp/picture%i.tiff", randomNumber);
Warning: Initialization Makes Pointer From Integer Without Cast
Look at what you assign to pathName: You have two expressions separated by comma in parentheses; the first one is @"/tmp/picture%i/tiff", which is Objective-C for a constant NSString*, and the second is randomNumber, which is an int. Two expressions separated by comma are a "comma-expression": The compiler evaluates the first expression, then the second expression, and the result is the second expression. So what you did is the same as assigning NSString* pathName = randomNumber.
Now I personally don't like the warning message; I would have written "attempt to assign an integer to a pointer", and it should most definitely be an error, not just a warning.
The "without cast" is a red herring: Casting that expression to NSString* will get rid of the warning, but it won't fix the problem. It will take randomNumber, which is lets say 9999, cast it to an NSString* which means you will get a rubbish pointer, and when you try to use pathName you will most likely get a crash. So in this case adding a cast is the worst thing that you can do.