Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8255381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:30:17+00:00 2026-06-08T01:30:17+00:00

When I go back from my secondView to my mainView I’m processing something in

  • 0

When I go back from my secondView to my mainView I’m processing something in the viewDidDisappear method of my secondView. The problem is, my mainView gets stuck due to the work the app has to do.

Here is what I do:

-(void)viewDidDisappear:(BOOL)animated
{
    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);

    dispatch_async(queue, ^{

    dbq = [[dbqueries alloc] init];

    [[NSNotificationCenter defaultCenter] postNotificationName:@"abc" object:nil];
    //the notification should start a progressView, but because the whole view gets stuck, I can't see it working, because it stops as soon as the work is done

    dispatch_sync(dispatch_get_main_queue(), ^{

    //work    

    });
});

What am I doing wrong?
Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T01:30:19+00:00Added an answer on June 8, 2026 at 1:30 am

    You need to perform your work in the dispatch_async to your queue. You are currently doing the work (assuming the // Work comment is where it goes) in the main thread, and in addition you are blocking your worker thread waiting for this work.

    Try to rearrange your GCD calls a bit:

    -(void)viewDidDisappear:(BOOL)animated
    {
        dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
    
        dbq = [[dbqueries alloc] init];
    
        [[NSNotificationCenter defaultCenter] postNotificationName:@"abc" object:nil];
    
        dispatch_async(queue, ^{
    
            // Perform work here
    
            dispatch_async(dispatch_get_main_queue(), ^{
    
               // Update UI here
    
            });
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a newbie question! I have a problem coming back from a view
I've a problem with something that seems to be very simple. My app has
How to get back from encoded byte[] to java.security.Key? import java.security.Key; import javax.crypto.SecretKey; import
The data format I got back from URL is in this format: #RES#[{status:Stopped \/
I've got XML coming back from an Ajax.Request in Ajax.Response.responseXML . My XML actually
How do I force full post-back from a button within an UpdatePanel?
I am trying to get data back from a PHP file assigned with GET
I have the following JSON coming back from a web service which I am
I've run into a situation where the Hibernate object passed back from the query
I am trying to receive a json object back from php after sending data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.