I`m inspired JailBrokenDector Project. But JailBrokenDector proejct is writed Objective-C. Then I rewrite this code from Objective-C to Swift 2.0.
// using do-try-catch
do {
try MOJailBrokenDector.isBroken()
} catch JailBrokenError.Detected(let fileName) {
print("Device is broken : \(fileName)")
} catch {
print("Error : \(error)")
}
// using guard
guard let isBroken = try? MOJailBrokenDector.isBroken() else {
print("Device is broken")
return;
}
I don't have jail broken device.. then, I didn`t test real device.