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

The Archive Base Latest Questions

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

So I am writing an app that will read a JSON feed. In my

  • 0

So I am writing an app that will read a JSON feed. In my application:didFinishLaunchingWithOptions, I am writing some code to download the JSON string and store it into a local NSString variable. I will then pass that string into ListingsViewController (which is the Root VC of the NavigationController). When I print out the JSON data in ListingsViewController, it is showing me (null) which is making me think that viewDidLoad is loading before – which seems illogical?

So here is my application:didFinishLaunchingWithOptions

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

    // Grab the feeds    
    NSURL *jsonURL = [NSURL URLWithString:@"http://www.shoofeetv.com/iphonexml/view/all_channels.json"];
    NSString *jsonData = [[NSString alloc] initWithContentsOfURL:jsonURL];

    // Pass jsonData to the ListingsViewController
    ListingsViewController *listingsViewController = [[ListingsViewController alloc] initWithNibName:@"ListingsViewController" bundle:nil];
    listingsViewController.jsonData = jsonData;
    [listingsViewController release];

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

    return YES;
}

My viewDidLoad method is as follows:

- (void)viewDidLoad {

    self.navigationItem.title = @"Listings";
    UIBarButtonItem *checkinButton = [[UIBarButtonItem alloc]
                                  initWithTitle:@"Check In" 
                                  style:UIBarButtonItemStylePlain
                                  target:self
                                  action:@selector(switchView)];

    self.navigationItem.rightBarButtonItem = checkinButton;
    [checkinButton release];

   NSLog(@"%@", self.jsonData);

   [super viewDidLoad];
}

Please note that a common solution is to make sure that the App Delegate in MainWindow.xib must be connected to the File’s Owner. Mine already is connected.

I will appreciate any help!

Thank you everyone.

  • 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-23T02:21:51+00:00Added an answer on May 23, 2026 at 2:21 am

    well you are setting up a view controller with your code, but it is never shown within the navigation controller. you just set up a view controller, assign its jsonData a string and destroy the view controller immediately. I#m pretty sure the output you get is from a different view controller that you create in your main XIB.

    what you want to do is create an empty navigation controller in your XIB and then do the following:

    // Pass jsonData to the ListingsViewController
    ListingsViewController *listingsViewController = [[ListingsViewController alloc] initWithNibName:@"ListingsViewController" bundle:nil];
    listingsViewController.jsonData = jsonData;
    [self.navigationController pushViewController:listingsViewController animated:NO];
    [listingsViewController release];
    
    // Display the navigation controller
    self.window.rootViewController = self.navigationController;
    [self.window makeKeyAndVisible];
    

    this will actually display the view controller you created.

    Also remember that when you deploy your application, you need to load your json-data asynchronously and handle network errors (apple will test your app under various network conditions)

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

Sidebar

Related Questions

I have to create an app that will read in some info from a
I'm writing a C# app to read a file that another application holds open.
I'm writing an app that will need to make use of Timer s, but
We are writing an app that will use T4 to generate Flex/Actionscript to compile
I'm writing an app that will basically be like Fraps, but it will push
I am writing an app that will need to unzip user uploaded archives. PHP
Here is the scenario: I'm writing an app that will watch for any changes
I'm writing an app that connect to a website and read one line from
I am writing a simple Windows app in c++, that will be able to
I am trying to deserialize a JSON string for an iOS app that I

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.