Getting the UDID of an iOS device

[[UIDevice currentDevice] uniqueIdentifier]

Clean & rebuild

Oh, boy. I’d been struggling with this for a while. I loaded a view from a nib, and my app kept crashing with an exception saying: loaded the “foo” nib but the view outlet was not set. I was like WTH, I definitely connected the view outlet to the ViewController, what’s going on? I kept resaving the nib, recompiling the app, but to no avail.

After digging some forum threads about this exception I got the idea of cleaning my builds. I did so, and guess what: after rebuilding my app it worked!

Sweet mother of god, why didn’t the compiler notice that I changed the nib?

NSTimer invalidate

When you create an NSTimer, and specify it to be a non-repeat timer, you don’t have to invalidate it after it fired.

When you created a repeating timer, you send the invalidate message to it to remove it from the NSRunLoop object it was added to, and thus stopping it from being fired any more. When you invalidated an NSTimer object, you cannot use it again.

More info here and here.