출처: http://bitxflow.synology.me/wordpress/?p=311%20

swift: https://indra17.tistory.com/entry/ios-%ED%83%88%EC%98%A5%ED%8F%B0-%EC%B2%B4%ED%81%ACswift

+(BOOL)isJailbroken{
#if !(TARGET_IPHONE_SIMULATOR)
    if ([[NSFileManager defaultManager] fileExistsAtPath:@”/Applications/Cydia.app”]){
        return YES;
    }else if([[NSFileManager defaultManager] fileExistsAtPath:@”/Library/MobileSubstrate/MobileSubstrate.dylib”]){
        return YES;
    }else if([[NSFileManager defaultManager] fileExistsAtPath:@”/bin/bash”]){
        return YES;
    }else if([[NSFileManager defaultManager] fileExistsAtPath:@”/usr/sbin/sshd”]){
        return YES;
    }else if([[NSFileManager defaultManager] fileExistsAtPath:@”/etc/apt”]){
        return YES;
    }
    return NO;

    NSError *error;
    NSString *stringToBeWritten = @"This is a test.";
    [stringToBeWritten writeToFile:@”/private/jailbreak.txt” atomically:YES encoding:NSUTF8StringEncoding error:&error];
    if(error==nil){
        //Device is jailbroken
        return YES;
    } else {
        //Device is not jailbroken
        [[NSFileManager defaultManager] removeItemAtPath:@”/private/jailbreak.txt” error:nil];
    }
    if([[UIApplication sharedApplication] canOpenUrl: [NSURL URLWithString:@”cydia://package/com.example.package”]]){
        //Device is jailbroken
    }
#endif
  
    //All checks have failed. Most probably, the device is not jailbroken
    return NO;
}

'develop > iOS' 카테고리의 다른 글

ios 탈옥폰 체크(swift)  (0) 2020.04.23
swift 타입체크 함수 (UIViewController)  (0) 2019.12.11
xcode에서 개발/운영 환경 설정  (0) 2019.03.28
swift에서 macro define 사용하기  (0) 2019.03.28
swift용 SQLite 클래스  (0) 2018.07.13

+ Recent posts