在iOS 11或更高版本中检测越狱

时间:2018-03-09 13:32:28

标签: ios cordova

使用" https://github.com/leecrossley/cordova-plugin-jailbreak-detection"但是,由于Cydia和其他选项在最新的11个iOS版本中被绕过,它仍然没有检查JAILBROKEN

如何使用Cordova或本机代码处理最新的iOS?

2 个答案:

答案 0 :(得分:2)

有一篇详细说明的文章。它与iOS 11相关。

How to check your app is installed on a jailbroken device

该文章(Swift变体)的解决方案:

if TARGET_IPHONE_SIMULATOR != 1 {
// Check 1 : existence of files that are common for jailbroken devices
    if FileManager.default.fileExists(atPath: “/Applications/Cydia.app”)
    || FileManager.default.fileExists(atPath: “/Library/MobileSubstrate/MobileSubstrate.dylib”)
    || FileManager.default.fileExists(atPath: “/bin/bash”)
    || FileManager.default.fileExists(atPath: “/usr/sbin/sshd”)
    || FileManager.default.fileExists(atPath: “/etc/apt”)
    || FileManager.default.fileExists(atPath: “/private/var/lib/apt/”)
    || UIApplication.shared.canOpenURL(URL(string:”cydia://package/com.example.package”)!) {

    return true
}

// Check 2 : Reading and writing in system directories (sandbox violation)
let stringToWrite = “Jailbreak Test”
do {
    try stringToWrite.write(toFile:”/private/JailbreakTest.txt”, atomically:true, encoding:String.Encoding.utf8)
    //Device is jailbroken
    return true
} catch {
    return false
}

答案 1 :(得分:1)

在本机代码中:您可以使用DTTJailbreakDetection,它位于Objective-C中。如果您使用swift,则需要使用bridging header

Objective-C:

tableView.window != nil

夫特:

if ([DTTJailbreakDetection isJailbroken]) {

    // your code
}