Don't know who to credit for this, although it uses techniques discussed here, here is a snippet of code that shows one way to detect pirated copies of your application.
The problem with this snippet, though, is that by putting this logic in an Objective-C method with an obvious name, you actually make it pretty easy for hackers to bypass or change this check. Instead, take the same basic logic and make it a C function and make sure you compile with debug symbols off. Better yet, make it a static inline function and call it from several places. This will scatter the same exact logic several places throughout your code, making cracking your program much more of a hassle.
You can never make any program that's completely unhackable, but you can make it a bit of a pain for the hackers and perhaps delay it from getting out on to the hacker sites for a little while.