how to detect tvOS is jailbroken using swift

Viewed 419

Is there any way to detect in tvOS app if the apple tv is jailbroken or not ? Tried same method as used in iPhone to detect jailbroken but it does not work as per the reference link - How do I detect that an iOS app is running on a jailbroken phone?

NSString *filePath = @"/Applications/Cydia.app";
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath])
{
   // do something useful
}

This method does not work, any API specific for tvOS app to detect jailbroken ?

1 Answers

You can check if any of these files exist (Cydia stuff):

  • /private/var/lib/cydia
  • /var/cache/apt
  • /var/lib/apt
  • /var/lib/cydia

Many people also install OpenSSH on their jailbroken devices, so check for:

  • /usr/sbin/sshd
  • /usr/bin/sshd

If Cydia is not installed - check the root partition permissions - /.

If you can read/write, the device is most likely jailbroken.

You could also try fork() - the sandbox won't allow it, hence it will succeed in a jailbroken environment.


Note: Keep in mind there's plenty of tools in Cydia and on the Internet to bypass jailbreak checks.

Related