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.