Detect if iOS app hacked

You can detect two files: SC_Info and iTunesMetadata.​plist.

If you can't find them, then your app was pirated: these files are installed after downloading from the App Store.

This is the code to check:

NSString * bundlePath = [ [NSBundle mainBundle] bundlePath ];
if ( ! [ [NSFileManager defaultManager] fileExistsAtPath: ( @"%@/SC_Info", bundlePath ) ] )
{
    // jailbroken
}
if ( ! [ [NSFileManager defaultManager] fileExistsAtPath: ( @"%@/iTunesMetadata.​plist", bundlePath ) ] )
{
    // jailbroken
}

There are some libraries around which can detect if an app is cracked (and jailbroken as well), this question gives a good overview but basically its done by checking the signer identity

one library is AntiCrack. I havent used this library so I dont know how well it works