美文网首页
如何在代码里判断设备有没有越狱

如何在代码里判断设备有没有越狱

作者: 夏夏的一些事 | 来源:发表于2016-11-08 12:26 被阅读0次

    - (BOOL) isJailBroken

    {

    BOOL jailbroken = NO;

    NSString *cydiaPath = @"/Applications/Cydia.app";

    NSString *aptPath = @"/private/var/lib/apt/";

    if ([[NSFileManager defaultManager] fileExistsAtPath:cydiaPath]) {

    jailbroken = YES;

    }

    if ([[NSFileManager defaultManager] fileExistsAtPath:aptPath]) {

    jailbroken = YES;

    }

    return jailbroken;

    }

    @interface UIDevice (Helper)

    - (BOOL)isJailbroken;

    @end

    @implementation UIDevice (Helper)

    - (BOOL)isJailbroken {

    BOOL jailbroken = NO;

    NSString *cydiaPath = @"/Applications/Cydia.app";

    NSString *aptPath = @"/private/var/lib/apt/";

    if ([[NSFileManager defaultManager] fileExistsAtPath:cydiaPath]) {

    jailbroken = YES;

    }

    if ([[NSFileManager defaultManager] fileExistsAtPath:aptPath]) {

    jailbroken = YES;

    }

    return jailbroken;

    }

    @end

    相关文章

      网友评论

          本文标题:如何在代码里判断设备有没有越狱

          本文链接:https://www.haomeiwen.com/subject/pzuauttx.html