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 9014303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:28:32+00:00 2026-06-16T03:28:32+00:00

So this is my first post, I’ve found this site incredibly informative in my

  • 0

So this is my first post, I’ve found this site incredibly informative in my brief history with Objective C and iOS programming. Anyhow, I’ve run into a problem of sorts. A quick summary: I’m attempting to write a login form, which uses calls a custom class that with hit a webserver to auth using NSURLConnection. I’m using protocols and delegates to delegate back to the calling class to perform a segue to the main menu view controller once the authentication is complete.

The problem is that the menu I’m attempting to segue into takes anywhere from 6 to 75 seconds to display. If I remove the API call, it loads immediately. However, I’m doing logging throughout the process, and everything appears to step through at a normal pace. I even log when the menu view controller is loaded, and all logging happens normally. But the actual display of the menu is delayed!

Here are some code details:

View Controller Methods:

- (void) userLogin:(NSString *)userName password:(NSString *)password {
    NSLog(@"VC login method");
    api = [theAPI getSelf];
    [api setDelegate:self];
    [api userLogin:userName password:password];
}

- (void) userLoginDone:(BOOL)successful {
    [self performSegueWithIdentifier:@"sgLoginToMainMenu" sender:self];
    NSLog(@"Login Done");
}

API Method:

- (void) userLogin:(NSString *)userName password:(NSString *)password {
    NSURL *url = [NSURL URLWithString:(NSString *) [API_PATH stringByAppendingString:@"test.html"]];
    NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
    NSOperationQueue *queue = [[NSOperationQueue alloc] init];

    [NSURLConnection sendAsynchronousRequest:urlRequest queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
        NSDictionary *json = [[JSON new] parseJSON:data];

        self.usrID = [json objectForKey:@"usrID"];
        self.sessionID = [json objectForKey:@"sessionID"];
        self.userName = [json objectForKey:@"Username"];

        NSLog(@"Username: %@", [json objectForKey:@"Username"]);

        [[self delegate] userLoginDone:YES];
    }];
}

All the NSLogs execute in a normal timespan (few milliseconds). Yet the main menu view controller takes entirely too long to appear! I’m very new to iOS programming, so I’m hoping I’m just overlooking something that googling couldn’t solve. Any help would be greatly appreciated!

  • 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-16T03:28:34+00:00Added an answer on June 16, 2026 at 3:28 am

    You need to update the UI on the main thread, but userLoginDone: is being called on an NSOperationQueue, which create its own separate thread. This could explain the delay in displaying. Have you tried using [NSOperationQueue mainQueue] (which returns the queue associated with the main thread) to pass to sendAsynchronousRequest: instead?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my first post, but I have been using this site for a
This is my first post on this site :-) I'm learning F#. To do
This is my first post, but I've been using the site for years. However,
This is my first post, and I've only recently started programming for Android and
this if my first post so please be gentle. I have an iOS 5
this is my first post on this great source of programming information. I have
This is my first post at this site. I searched alot but couldn't find
This is my first post here, but I've using this site regularly to help
This is my first post, I'm new to this site, but I've been lurking
this is my first post here. I'm new to Python and programming in general

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.