Note that there are some explanatory texts on larger screens.

plurals
  1. POrun performSegueWithIdentifier inside a queue
    text
    copied!<p>I'm trying to run a task in a new queue and then when this task is finish to inform to the VC to run a performSegueWithIdentifier to pass the next view controller.</p> <p>In a method button I have this call:</p> <pre><code> - (IBAction)previewButtonTouchedIn:(id)sender { prepareDesign(self.imageToEdit,self.maskImageToPrint,self.drawingView,^(UIImage* imageReturn){ self.previewDesignImage = imageReturn; [self performSegueWithIdentifier:PREVIEW_SEGUE sender:self]; }); } </code></pre> <p>and the method called, contains:</p> <pre><code> void prepareDesign(UIImage *imageToEdit,UIImage *maskImageToPrint,UIView *drawingView, void (^block)(UIImage*) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ //Here the task which I want to run in a new queue UIImage *imageSnapShot = [UIImage imageWithCGImage:imageRef]; CGImageRelease(imageRef); //I have tested with dispatch_sync and dispatch_async. dispatch_sync(dispatch_get_main_queue(), ^{ block(imageSnapShot);}); }); } </code></pre> <p>I have tested with </p> <pre><code> [[NSOperationQueue mainQueue] addOperationWithBlock:^{ block(imageSnapShot);}]; </code></pre> <p>instead of </p> <pre><code> dispatch_sync(dispatch_get_main_queue(), ^{ block(imageSnapShot);}); </code></pre> <p>And I have checked with breakpoint that the <code>performSegueWithIdentifier</code> is run with the main thread setting the breakpoint in the <code>performSegueWithIdentifier</code> call and in the <code>prepareForSegue:sender:</code>.</p> <p>The screen is simply frozen. Any ideas?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload