Linke Address:http://www.cnblogs.com/zhw511006/archive/2011/07/09/2101644.html
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,则没被破解。