博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

检测iphone设备是否越狱

Posted on 2011-11-21 16:02  星尘的天空  阅读(387)  评论(0编辑  收藏  举报

Linke Address:http://www.cnblogs.com/zhw511006/archive/2011/07/09/2101644.html

detectDevice.h

  1. @interface UIDevice (Helper)  
  2. - (BOOL)isJailbroken;  
  3. @end  

 

detectDevice.m

  1. @implementation UIDevice (Helper)  
  2. - (BOOL)isJailbroken {  
  3. BOOL jailbroken = NO;  
  4. NSString *cydiaPath = @"/Applications/Cydia.app";  
  5. NSString *aptPath = @"/private/var/lib/apt/";  
  6. if ([[NSFileManager defaultManager] fileExistsAtPath:cydiaPath]) {  
  7. jailbroken = YES;  
  8. }  
  9. if ([[NSFileManager defaultManager] fileExistsAtPath:aptPath]) {  
  10. jailbroken = YES;  
  11. }  
  12. return jailbroken;  
  13. }  
  14. @end   

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