判断手机是否越狱

```

+ (BOOL)isJailBreak

{

    //    1.通过越狱后增加的越狱文件判断

    NSArray *jailbreak_tool_paths = @[ @"/Applications/Cydia.app", @"/Library/MobileSubstrate/MobileSubstrate.dylib", @"/bin/bash", @"/usr/sbin/sshd", @"/etc/apt" ];

    for (int i=0; i

    {

        if ([[NSFileManager defaultManager] fileExistsAtPath:jailbreak_tool_paths[i]])

        {

            NSLog(@"The device is jail broken!");

            return YES;


        }

    }

```

    //    3.根据是否能获取所有应用的名称判断

```  

  if ([[NSFileManager defaultManager] fileExistsAtPath:@"User/Applications/"])

    {

        NSLog(@"The device is jail broken!");

        NSArray *appList = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"User/Applications/" error:nil]; NSLog(@"appList = %@", appList);

        return YES;


    }

```

    //        2.根据是否能打开cydia判断

```

//    if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"cydia://"]])

//    {

//        NSLog(@"The device is jail broken!");

//        return YES;

//    }

    NSLog(@"The device is NOT jail broken!");

    return NO;

}

```

你可能感兴趣的:(判断手机是否越狱)