Skip to content

Instantly share code, notes, and snippets.

@AnnieNinaJoyceV
Created May 4, 2017 12:35
Show Gist options
  • Save AnnieNinaJoyceV/cd5870c36d443aa85a33eea5316875ce to your computer and use it in GitHub Desktop.
Save AnnieNinaJoyceV/cd5870c36d443aa85a33eea5316875ce to your computer and use it in GitHub Desktop.
Function to check whether the device is Jail broken or not
fileprivate func isDeviceJailbroken() -> Bool {
let cydiaPath = "/Applications/Cydia.app" //Cydia is an alternative to Apple's App Store for "jailbroken" devices
if FileManager.default.fileExists(atPath: cydiaPath) {
return true
}
let protectedPath = "/private/jailbreak.test"
do {
try "0".write(toFile: protectedPath, atomically: true, encoding: String.Encoding.utf8)
return true
} catch {
return false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment