You can look for Cydia (or similar apps) with NSFileManager. And you should check if you have access to the bash on the phone. You can try something like this:
- (BOOL) isJailbroken
{
//If the app is running on the simulator
#if TARGET_IPHONE_SIMULATOR
return NO;
//If its running on an actual device
#else
BOOL isJailbroken = NO;
//This line checks for the existence of Cydia
BOOL cydiaInstalled = [[NSFileManager defaultManager] fileExistsAtPath:@"/Applications/Cydia.app"];
FILE *f = fopen("/bin/bash", "r");
if (!(errno == ENOENT) || cydiaInstalled) {
//Device is jailbroken
isJailbroken = YES;
}
fclose(f);
return isJailbroken;
#endif
}
This code is not really tested.. let me know if it worked.