根据是否能读取Cydia或apt或Applications来判断
+(BOOL)deviceIsJailBreak{
BOOL isJailBreak = NO;
NSString *cydiaPath = @"/Applications/Cydia.app";
NSString *aptPath = @"/private/var/lib/apt/";
if ([[NSFileManager defaultManager] fileExistsAtPath:cydiaPath]||[[NSFileManager defaultManager] fileExistsAtPath:aptPath]||[[NSFileManager defaultManager] fileExistsAtPath:@"User/Applications/"]) {
isJailBreak = YES;
}
return isJailBreak;
}
也可以直接用友盟的 MobClick.h 里提供的方法,注释上看也是判断Cydia或apt:
/** 判断设备是否越狱,依据是否存在apt和Cydia.app
*/
+ (BOOL)isJailbroken;