diff --git a/yalu102/ViewController.m b/yalu102/ViewController.m index 53eb770..9a0e625 100644 --- a/yalu102/ViewController.m +++ b/yalu102/ViewController.m @@ -65,8 +65,10 @@ - (bool) alreadyJailbroken { - (void) performForJailbrokenState { // Check if the device is already jailbroken and change the UI accordingly if ([self alreadyJailbroken]) { - [dope setEnabled:NO]; - [dope setTitle:@"already jailbroken" forState:UIControlStateDisabled]; + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + [dope setEnabled:NO]; + [dope setTitle:@"already jailbroken" forState:UIControlStateDisabled]; + }]; } } @@ -149,17 +151,21 @@ - (IBAction)yolo:(UIButton*)sender { - (void)doIt { #if TARGET_IPHONE_SIMULATOR - UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Cannot Jailbreak" message:@"You are currently running the app in the iOS Simulator. To jailbreak, run the tool on a real device." preferredStyle:UIAlertControllerStyleAlert]; - [alert addAction: [UIAlertAction actionWithTitle:@"Dismiss" style:UIAlertActionStyleCancel handler:nil]]; - [self presentViewController:alert animated:YES completion:nil]; + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Cannot Jailbreak" message:@"You are currently running the app in the iOS Simulator. To jailbreak, run the tool on a real device." preferredStyle:UIAlertControllerStyleAlert]; + [alert addAction: [UIAlertAction actionWithTitle:@"Dismiss" style:UIAlertActionStyleCancel handler:nil]]; + [self presentViewController:alert animated:YES completion:nil]; + }]; #else /* we out here! */ - [dope setEnabled:NO]; - [dope setTitle:@"jailbreaking" forState:UIControlStateDisabled]; + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + [dope setEnabled:NO]; + [dope setTitle:@"jailbreaking" forState:UIControlStateDisabled]; + }]; mach_port_t vch = 0; @@ -289,7 +295,9 @@ - (void)doIt { ports[i] = 0; } } - [dope setTitle:@"failed, retry" forState:UIControlStateNormal]; + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + [dope setTitle:@"failed, retry" forState:UIControlStateNormal]; + }]; return; foundp: @@ -309,7 +317,9 @@ - (void)doIt { } } } - [dope setTitle:@"failed, retry" forState:UIControlStateNormal]; + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + [dope setTitle:@"failed, retry" forState:UIControlStateNormal]; + }]; return; gotclock:;