没有越狱检测

8 xcode jailbreak ios

我正在尝试制作一个适用于越狱iDevices的应用程序.我已经进行了越狱检测:

([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"cydia://"]]);{
    UIAlertView *cydiaisinstalled=[[UIAlertView alloc]initWithTitle:@"Cydia is installed!"
                                                            message:@"You can use Respring!"
                                                           delegate:self
                                                  cancelButtonTitle:@"OK"
                                                  otherButtonTitles:nil];
    [cydiaisinstalled show];
}}
Run Code Online (Sandbox Code Playgroud)

但现在我需要相反的事情.我需要非JAILBREAK检测.

我需要你的帮助我需要这个用于Weblin.请帮我!!!

Tom*_*rle 8

尝试访问应用程序沙箱外的任何文件.例如:

BOOL IsDeviceJailbroken(void) {
    #if TARGET_IPHONE_SIMULATOR
    return NO;
    #else
    return [[NSFileManager defaultManager] fileExistsAtPath: @"/bin/bash"];
    #endif
}
Run Code Online (Sandbox Code Playgroud)

请注意,安装Cydia并使用越狱设备是两回事.


pas*_*aya 6

我写了一个函数来检测设备是否为另一个问题越狱,但这似乎与此相关:

- (BOOL) isJailbroken() {

    //If the app is running on the simulator
    #if TARGET_IPHONE_SIMULATOR
        return NO;

    //If its running on an actual device
    #else
        BOOL isJailbroken = NO;

        //This line checks for the existence of Cydia
        BOOL cydiaInstalled = [[NSFileManager defaultManager] fileExistsAtPath:@"/Applications/Cydia.app"];

        FILE *f = fopen("/bin/bash", "r");

        if (!(errno == ENOENT) || cydiaInstalled) {

            //Device is jailbroken
            isJailbroken = YES;
        }            
        fclose(f);
        return isJailbroken;
    #endif
}
Run Code Online (Sandbox Code Playgroud)

此功能使用两个检查来查看手机是否越狱:它首先检查是否安装了Cydia.并非所有越狱设备都安装了Cydia,尽管大多数都安装了,所以我也检查了bash的存在,它也只出现在越狱设备上.请注意,此功能几乎适用于所有情况,但可能不是100%.在他们越狱的iDevice上唯一没有Cydia的人可能就是那些正在试验越狱设备并且不使用它们来获得调整和主题等优点的人.