如果我想让一个应用程序运行一个命令来检查一个设备是否越狱了,我该怎么做呢?
(这是我想要执行的命令,如果程序能够确定是否安装了Cydia )
UIAlertView *jailbreakDetection = [[UIAlertView alloc]
initWithTitle:@"Jailbreak Detected"
message:@"This application will not run while a jailbreak is installed."
delegate:nil
cancelButtonTitle:nil
otherButtonTitles:nil];
[jailbreakDetection show];通过显示此警报,用户无法运行应用程序,因为无法阻止消息在屏幕上显示。我已经研究过一些类似的问题,但是没有一个问题对我有用,例如,当我运行这段代码时,我得到了一个错误“预期的标识符或‘(’)”。我在NavigationController.m文件中运行它,以便在启动初始应用程序时击中用户。
NSString *filePath = @"/Applications/Cydia.app";
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath])
{
UIAlertView *jailbreakDetection = [[UIAlertView alloc]
initWithTitle:@"Jailbreak Detected"
message:@"This application will not run while a jailbreak is installed."
delegate:nil
cancelButtonTitle:nil
otherButtonTitles:nil];
[jailbreakDetection show];
}我这是怎么了?我应该把这个放在一个单独的文件里吗?
发布于 2013-12-23 22:06:12
您的代码不编译,因为它不是方法或函数的一部分。您必须将代码移到viewDidLoad。
(这个答案仅指编译器错误,而不是可能的越狱检测机制。)
发布于 2013-12-23 22:07:50
看起来,我错误地放置了一个"}",并且没有在ViewDidLoad参数中包含该语句。
在编辑程序之后,它工作得很好。
https://stackoverflow.com/questions/20751677
复制相似问题