[转]检测ios设备是否越狱

检测iphone设备是否越狱

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,则没被破解。

 

posted @ 2012-04-10 09:39  ahutzh  阅读(218)  评论(0)    收藏  举报