Converting integer/numeric values to Strings - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Converting integer/numeric values to Strings (/thread-3788.html)
Converting integer/numeric values to Strings - vnvrymdreglage - Oct 22, 2006 02:54 PM
My problem is : I need to take the numeric score value stored in an 'int' variable and convert it to an NSString or similar object that I can use to draw the score directly on to the screen. I can't seem to find any way to convert it, and using [NSString stringWithFormat:]; isn't working for me.
I'm sure this is pretty simple...any ideas?
Converting integer/numeric values to Strings - akb825 - Oct 22, 2006 02:57 PM
The proper way to do it with an NSString is
[NSString stringWithFormat:@"%d", intValue];
Of course, you will need to either retain it or use copy, otherwise it will be deleted next time the autorelease pool is emptied.
Converting integer/numeric values to Strings - vnvrymdreglage - Oct 22, 2006 06:21 PM
Thanks! I knew I was missing something simple. The game also crashes on my girlfriend's computer for some reason, even though the completely compiled game runs fine as a stand-alone executable on my computer. We also have the exact same computer : iBook G4 1.33 / 512 with Mac OS 10.4. I'm thinking it's either A) she needs a system update, B) I have a memory leak, or C) there's a problem loading the music, sound, and graphics on her computer. The last version of the game I sent her ran fine, but this one gives her a "Ended unexpectedly" error when she tries to run it. Any ideas of what's most likely wrong? I'm going to mess with it and tighten up my code and see if this fixes the issue.
Converting integer/numeric values to Strings - unknown - Oct 22, 2006 07:45 PM
check console.app for error information, if there isnt anything put NSLog's in and around bits of code you think could be causing the crash.. like loading game resources.
Converting integer/numeric values to Strings - longjumper - Oct 23, 2006 01:38 PM
Did you build with zerolink?
Converting integer/numeric values to Strings - vnvrymdreglage - Oct 23, 2006 07:18 PM
Nope..I'm using the "Release" build configuration.