越狱检查方法,苹果会批准这个吗?

时间:2015-07-07 14:00:21

标签: ios iphone jailbreak

在我的应用程序中,我需要检查运行设备是否是越狱设备。这是我找到的最完整的方法:

BOOL Jail=NO;
if ([[NSFileManager defaultManager] fileExistsAtPath:@"/Applications/Cydia.app"] ||
   [[NSFileManager defaultManager] fileExistsAtPath:@"/Library/MobileSubstrate/MobileSubstrate.dylib"] ||
   [[NSFileManager defaultManager] fileExistsAtPath:@"/bin/bash"] ||
   [[NSFileManager defaultManager] fileExistsAtPath:@"/usr/sbin/sshd"] ||
   [[NSFileManager defaultManager] fileExistsAtPath:@"/etc/apt"] ||
   [[NSFileManager defaultManager] fileExistsAtPath:@"/private/var/lib/apt/"] ||
   [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"cydia://package/com.example.package"]])  {
  Jail= YES;
}

FILE *f = NULL ;
if ((f = fopen("/bin/bash", "r")) ||
   (f = fopen("/Applications/Cydia.app", "r")) ||
   (f = fopen("/Library/MobileSubstrate/MobileSubstrate.dylib", "r")) ||
   (f = fopen("/usr/sbin/sshd", "r")) ||
   (f = fopen("/etc/apt", "r")))  {
  fclose(f);
  Jail= YES;
}
fclose(f);

NSError *error;
NSString *stringToBeWritten = @"This is a test.";
[stringToBeWritten writeToFile:@"/private/jailbreak.txt" atomically:YES encoding:NSUTF8StringEncoding error:&error];
[[NSFileManager defaultManager] removeItemAtPath:@"/private/jailbreak.txt" error:nil];
if(error == nil)
{
  Jail= YES;
}

我找不到的,这是一个明确的答案:" Apple将批准此代码?" ,在我可以阅读的指南中:

"Apps that read or write data outside its designated container area will be rejected".

但很明显,我只是想写或只是为了检查设备是否已经越狱......那么有人成功将此代码提交给苹果吗?

2 个答案:

答案 0 :(得分:2)

这是已提交应用的代码

BOOL bash = NO;

FILE *f = fopen("/bin/bash", "r");
if (f != NULL)
{
    bash = YES;
}
fclose(f);

return bash;

所以,我相信您的代码也会被接受

答案 1 :(得分:0)

可能。

许多开发者因包括越狱检查而被拒绝,许多人没有。如果您提交越狱检查,您应期望获得批准(尽管您可能会在此次审核过程中完成)。