I have just released my app for iOS, but I'm not sure how to make my app safe from being used by jailbrakers.
Can I do something to prevent my app working on jailbroken devices?
I have just released my app for iOS, but I'm not sure how to make my app safe from being used by jailbrakers.
Can I do something to prevent my app working on jailbroken devices?
/**
Detect that the app is running on a jailbroken device or not
- returns: bool value for jailbroken device or not
*/
public class func isDeviceJailbroken() -> Bool {
#if arch(i386) || arch(x86_64)
return false
#else
let fileManager = FileManager.default
if (fileManager.fileExists(atPath: "/bin/bash") ||
fileManager.fileExists(atPath: "/usr/sbin/sshd") ||
fileManager.fileExists(atPath: "/etc/apt") ||
fileManager.fileExists(atPath: "/private/var/lib/apt/") ||
fileManager.fileExists(atPath: "/Applications/Cydia.app") ||
fileManager.fileExists(atPath: "/Library/MobileSubstrate/MobileSubstrate.dylib")) {
return true
} else {
return false
}
#endif
}
There is no way to detect if device is jailbroken.
Consider that even if there was, the device has already been jailbroken, meaning arbitrary code execution is possible, and the jailbreaker would just modify whatever method of detection you would use to signal that the device has not been jailbroken.
reference: https://forums.developer.apple.com/thread/43073
credits go to Apple Staff who answered this same question