IOS判断设备是否已越狱(isJailbroken)

有些时候我们要判断app运行的设备是否已越狱

@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

相关博文

    分享到:

About rainbird

IOS攻城狮
This entry was posted in IOS开发, object-c, 默认分类 and tagged , , , . Bookmark the permalink.

发表评论