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