Umeng统计的Mobclick.h里面已经包含了越狱检测的代码,可以直接使用
apt和Cydia的方式来进行判断的,没看见源码
然后再介绍两种方法来查看是否已经越狱,知其然知其所以然、、、
1. apt
- (BOOL) hasAPT
{
return [[NSFileManager defaultManager] fileExistsAtPath:@"/private/var/lib/apt/"];
}
2. system
- (BOOL) successCallSystem
{
return (system("ls") == 0) ? YES : NO;
}
3.
staticconstchar* jailbreak_apps[] =
@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
仅供参考、、、