detect if iOS device is jailbroken

Any useful code to detect if iOS device running my application is jailbroken?


There is not. 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.

Thanks for that response. Understanding that most methods can be circumvented with extra effort, is there a recommended approach that can detect more casual users? Users that don't attempt to modify the method of detection, for example?

Many of the approaches for jailbreak detection I've seen simulate actions by a jailbroken device, such as trying to access the filesystem outside of the app's sandbox. Would these types of detection methods cause an app to be rejected from the Apple Store?

If the review process detects the app attempting to violate its sandbox constraints, that's going to be grounds for rejection. "Oh, I was just checking to see if I could" isn't going to be a defense against that.

Apparently Cyd!a (name will be starred out so I had to replace the i with an exclamation mark) provides several URL schemes. Perhaps you could do something like this to test whether or not your app is running on a jailbroken device?

guard let urlScheme = NSURL(string: "cyd!a://home"), UIApplication.sharedApplication().canOpenURL(urlScheme) else {

Thanks for the response. That makes sense, and what I was concerned about.

Knowing that most techniques can be circumvented with additional effort, what's the "approved" method for simple jailbreak detection?