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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:50:04+00:00 2026-05-23T04:50:04+00:00

I am downloading a JSON feed asynchronously in my App Delegate class. Now the

  • 0

I am downloading a JSON feed asynchronously in my App Delegate class. Now the data is taking a while to load, so my table view appears empty at first, and then populates a few seconds after. Therefore, I would like to either:

1- Find out what is causing this delay. Therefore, keep all the activity in the application:didFinishLaunchingWithOptions method and only load the VC after everything has been loaded.

OR

2- Display an activity indicator until the table populates the data.

Now in the first scenario, I am pretty sure that I am pushing the view controller at the wrong time. I tried playing around with it but it seems that that is the only way my app will build and run.

In the second scenario, I would like to know which “connection” method gets invoked first, and which one last. Therefore, I will be able to start up the activity indicator view at the first method and release at the end of the last method.

Below is my code. Any suggestions/help is greatly appreciated. Thank you for reading.

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
        [responseData setLength:0];
}

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
     [responseData appendData:data];
}

- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {

     UIAlertView *alert = [[UIAlertView alloc] 
                      initWithTitle:@"Error" 
                      message:@"Please check your network connection and relaunch the application" 
                      delegate:self 
                      cancelButtonTitle:@"Dismiss" 
                       otherButtonTitles:nil, nil];
    [alert show];
    [alert release];
}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection {

    NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];

    if ([responseString isEqualToString:@"Unable to find specified resource."]) {
        NSLog(@"Unable to find specified resource.n");
    } 

        else {

        ListingsViewController *listingsViewController = [[ListingsViewController alloc] initWithNibName:@"ListingsViewController" bundle:nil];
        listingsViewController.jsonData = responseString;
        [self.navigationController pushViewController:listingsViewController animated:NO];
        [self.navigationController setViewControllers:[NSArray arrayWithObject:listingsViewController] animated:NO];
        [listingsViewController release];
     }

    [connection release];
    [responseData release];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    // Start the HTTP request
    responseData = [[NSMutableData data] retain];
    NSURLRequest *request = [NSURLRequest requestWithURL:
                         [NSURL URLWithString:@"http://www.shoofeetv.com/iphonexml/view/all_channels.json"]];
    [[NSURLConnection alloc] initWithRequest:request delegate:self];

    // Display the navigation controller
    self.window.rootViewController = self.navigationController;
    [self.window makeKeyAndVisible];

    return YES;
}
  • 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-05-23T04:50:05+00:00Added an answer on May 23, 2026 at 4:50 am

    Go with option 2. It’s good UI design to display things as quickly as possible, even though the UI might not be useful until the data has loaded it will at least make users of your application feel like something is happening.

    Pop the UI in didFinishLaunchingWithOptions, display an activity indicator and in connectionDidFinishLoading hide and destroy the activity indicator.

    I would also recommend wrapping all the async http request logic in to another class, and have it accept a delegate, then for example you could call:

    {
       // Show activity indicator
       [httpClient get:@"www.example.com/json" withDelegate:self];
    }
    
    -(void)httpClientSuccessful:(NSData*)response
    {
       // hide activity indicator
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am downloading data from twitter using JSON feed by using SBJSON Framework example.
I am downloading and parsing JSON objects to build a news feed to populate
So I have an app that downloads and parses a JSON feed with some
So I am using NSURLConnection delegate to download a JSON feed in my AppDelegate.m
I am doing optimization of web app, where I get list data in JSON
I am downloading some JSON data from a webservice. In this JSON I've got
i m parsing a json feed .using async image download I m downloading images
I am downloading files with the WebClient class in .NET 3.5. I would like
I'm trying to grab data from a JSON on an external site but the
I wrote a custom JSON fetcher. From my view controller I call [loader start];

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.