Skip to content

Instantly share code, notes, and snippets.

@jeffniblack
Created September 18, 2012 16:01
Show Gist options
  • Save jeffniblack/3743918 to your computer and use it in GitHub Desktop.
Save jeffniblack/3743918 to your computer and use it in GitHub Desktop.
main for iOS jailbreak detection
int main(int argc, char *argv[])
{
bool lifeIsGood = YES; //assume things will be good
//do checks here...finding something bad sets lifeIsGood to NO
if ((fork_check())
|| (files_check())
|| (fstab_check())
|| (symbolic_link_check())) {
lifeIsGood = NO;
}
//now setup the run loop
@autoreleasepool {
if (lifeIsGood) {
//standard app delegate
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
} else {
//the jailbreak app delegate
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegateJB class]));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment