检测iphone设备是否越狱

长平狐 发布于 2012/08/13 15:44
阅读 90
收藏 0

如何查看是否越狱?最简单的方法就是查看你设备上是否多了越狱的目录。下面是代码。

 

detectDevice.h

 

@interface UIDevice (Helper)
- (BOOL)isJailbroken;
@end
 

detectDevice.m

@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
 

 

然后在你代码中调用[UIDevice currentDevice] isJailbroken], 如果返回YES说明被破解了,为NO,则没被破解。

 


原文链接:http://blog.csdn.net/favormm/article/details/6217723
加载中
返回顶部
顶部