Blog Archives

Getting an unique build tag for each Xcode build

Long had i pondered on getting a unique stamp in every build xcode makes, so i could more easily distinguish between builds when failures occur. Today i made a nice discovery. In your project right click on the name of

Tagged with: ,
Posted in Apple, Code

Taming Snow Leopard: stringWithCString: length depreciation

I know this one has been depreciated in 10.5 to but i never found a nice replacement until now: message = [NSString stringWithCString:(buffer + 4) length:(arg2 -5)]; becomes: message = [[[NSString alloc] initWithBytes:(buffer + 4) length:(arg2 -5) encoding:NSASCIIStringEncoding] autorelease];

Tagged with: , ,
Posted in Code

Taming Snow leopard: Format not a string literal and format arguments

I am porting MacTrek to OS X 10.6 native (from 10.4) and i got the “Format not a string literal and format arguments” error a couple of hundred times. Source of the problem is: #define LLLog if([[NSUserDefaults standardUserDefaults]boolForKey:@”LLLogDisabled”]!=YES)NSLog Apparently NSLog

Tagged with: ,
Posted in Code

Avoiding the 30 second tcp timeout on iPhone OS

So you are writing the next great iPhone app and you pull some data from a server using TCP, but what happens in the unhappy scenario? TCP timeout takes about 30 seconds, if in the main loop, your app freezes,

Tagged with: , ,
Posted in Code

The search for Zombies (NSZombies)

Debugging (auto)release errors It’s quite easy to release an object twice, causing Objective-C programs to crash somewhere else. Quite difficult to detect, therefore create the following .gdbinit file in your home folder: fb -[NSException raise] fb objc_exception_throw() fb -[_NSZombie release]

Tagged with:
Posted in Code

Playing a sound from Cocoa and setting the balance

The NSSound class is great for playing simple sounds, yet it lacks control over a more flexible way to play sounds. MacTrek plays sounds louder when they happen closer to the players position and balances them left or right when

Tagged with: ,
Posted in Code

Getting the version number from Info.plist in your code

If you are a lazy coder like me (or you don’t like to code version numbers all over the place) you should use the version number that Apple wants you to specify (in the Info.plist file) whenever you need to

Tagged with: , ,
Posted in Code
Categories