Search code examples
iosobjective-cjailbreakdetection

jailbreak detection exit App after 5 seconds


i want use this Code in my App:

 - (void)viewDidLoad {
 [super viewDidLoad];

 // Jailbreak Detection

 NSString *cydiaFilePath = @"/Applications/Cydia.app";

 if ([[NSFileManager defaultManager] fileExistsAtPath:cydiaFilePath])
 {
     // insert jailbreak code here...

     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];
 } }

And this Code still works. But i don't get an Button to Close the message and i want finish the App after close this Message.

Please can anyone help me to fix this? I don't understand it, i dont know what i do wrong.


Solution

  • You have set the cancel button and other button's titles to nil. You should set some title for the cancel button:

    UIAlertView *jailbreakDetection = [[UIAlertView alloc]
                                            initWithTitle:@"Jailbreak Detected"
                                                  message:@"This application will not run while a jailbreak is installed."
                                                 delegate:nil
                                        cancelButtonTitle:@"Close"
                                        otherButtonTitles:nil];