Sometimes is useful to check if your app/game is running in a jailbroken device, specially regarding security issues. Although Apple does not provide you with a function to check if the device is jailbroken or not (and in fact, they shouldn't, after all, if Apple provides that function, it will be one of the first things that the jailbroken script would modify), there is a very easy way to find that out. You can just use the code below.
Objective C code:
FILE *f = fopen(“/bin/ssh”, “r”);
If f~= NULL then
{
//jailbroken!!
}
fclose(f)