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

  • SEARCH
  • Home
  • 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 8987463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:48:00+00:00 2026-06-15T21:48:00+00:00

To start with it all works without using the the GCD but I want

  • 0

To start with it all works without using the the GCD but I want this happening in a separate thread so trying GCD. I’ve got a login screen where on pressing the login button i’ve got the following action:

- (void)login
{
    dispatch_queue_t buckyballLoginFetcherQ = dispatch_queue_create("Login Queue", NULL);
    dispatch_async(buckyballLoginFetcherQ, ^
    {
        NSDictionary *resultDictionary = [MyService login:self.name.text password:self.password.text];
        self.userDetails = [resultDictionary valueForKey:USER_DETAILS_ATTRIBUTE];
        [self performSegueWithIdentifier:@"Login" sender:self];
    });
}

In MyService method being called above:

+ (NSDictionary *)executeRequest:(NSDictionary *)requestDictionary
{
    // Prepare the URL request and do the following
    NSData *results = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&response error:&urlRequestError];

    // Process results
    ...
}

NOW the bit that crashes:

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"Login"])
{
    MyDestinationTableViewController *myDestinationTableViewController = nil;
    UITabBarController *tbc = (UITabBarController *)[segue destinationViewController];
    for (UIViewController *vc in [tbc viewControllers])
    {
        if ([vc isKindOfClass:[UINavigationController class]])
        { // in our case all view controlers are navigation controllers :-)
            UINavigationController *nc = (UINavigationController *)vc;
            if ([[[nc viewControllers] lastObject] isKindOfClass:[BuckyballsTableViewController class]])
            {
                myDestinationTableViewController = [[nc viewControllers] lastObject];

                /**************CRASH LINE************/
                buckyballsTableViewController.userDetails = self.userDetails;
            }
        }
    }
}

Again without GCD it works, but it holds up screen so i’d want to do it asynchronously. Is it the instance member causing a problem? OR do i need to use it differently or do more with it? Thank you…

  • 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-15T21:48:01+00:00Added an answer on June 15, 2026 at 9:48 pm

    Only the main thread may manipulate the UI, so use this code fragment to call those bits on the main thread:

    dispatch_async(dispatch_get_main_queue(), ^{
        [self performSegueWithIdentifier:@"Login" sender:self];
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to reboot some instances using ec2.reboot_instances([instanceId]) and that works fine but: how
I created this regex to match all words that start with @ in my
I've tried '--kiosk', '--start-maximized'; but all not work, any solution yet? Further, the web
I have this.setVolumeControlStream(AudioManager.STREAM_MUSIC); at the start of all activities in my application so when
My table is like this on Postgres, note that all days start by 01,
I'm trying to build a site that runs without refreshes, using Jquery and PHP
I'm using JUnit since I started this project and everything works just fine. I
I'm trying to use mysql_real_escape_string() to secure a log in form. Using this code:
Facts: using standard Symfony 2.0.10 release (includes vendors) all works fine . However with
I've got a WCF service that allows the uploading of files without using a

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.