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

2016-11-08  本文已影响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

上一篇下一篇

猜你喜欢

热点阅读