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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:57:41+00:00 2026-05-22T15:57:41+00:00

Note: I’ve only been using Objective-C for a week. Here’s my end goal: I

  • 0

Note: I’ve only been using Objective-C for a week.

Here’s my end goal: I want to call out to a server and grab a json file that has urls and url descriptions in it. If I can’t get that file, I want to show an error view. If I can get that file, I want to display its contents in a table view.

Restrictions: I’m doing this in a Cocoa Touch Static Library (by requirement) to be included in a larger app that will load it “like” an app.

What I’m doing right now is I’m using Reachability to check for a connection to the host. Then I’m opening an NSURLConnection for the file. Once the file is gotten, I parse the json using the json-framework. The datatype of the jsonObject is id (afaik that means *).

Currently, ALL of that is happening in the Delegate. If I get errors with connection or file retrieval, I set the rootView to the error view controller. Otherwise, I set the rootView to my other view.

I’ve tried the method of setting the jsonObject to extern in the view controller, but that didn’t work. I tried setting a property in the view controller and setting the jsonObject in the controller after I create it, but the jsonObject is nil at that point and everything blows up with some error regarding incorrect selectors or something.

Am I even headed in the right direction with this? How SHOULD this be done?

EDIT

My view controller is typed as UINavigationController and I stick whichever view controller I end up using into it. When I try to call a setter in my view controller, I have to cast the UINavigationController to my view type to be able to see the setter, but when I run it, I get the following error:

SpringboardApplication[5850:40b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UINavigationController setJsonObject:]: unrecognized selector sent to instance 0x602ed20'

I am calling it as follows:

[(LU_SOCLINKS_RootViewController *) root_navigation_controller setJsonObject:jsonObject];
  • 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-22T15:57:42+00:00Added an answer on May 22, 2026 at 3:57 pm

    By “delegate” you mean the app delegate? I assume that the view controller is in an instance variable in your app delegate, in which case you just need to create a setter method in the view controller that you can use to pass the data.

    In the view controller:

    .h

    - (void)setData:(NSData/NSString/whatever *)data;
    

    .m

    - (void)setData:(NSData/NSString/whatever *)data {
        vcData = [data retain];
        // do stuff with the data
    }
    

    In the app delegate

    [viewController setData:theData];
    

    This is a simplistic answer. Am I understanding your problem correctly?

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

Sidebar

Related Questions

Note: I do NOT want to use any framework. The goal is just to
Note: This was posted when I was starting out C#. With 2014 knowledge, I
NOTE: I am not set on using VI, it is just the first thing
Note : The code in this question is part of deSleeper if you want
(Note: This is for MySQL's SQL, not SQL Server.) I have a database column
Note: I will not be using salts. Thanks for your advice though! I'm testing
Note: I am not sure if this is better here, or at superuser, but
NOTE: I thought I was using bash, but /bin/sh is linked to /bin/dash, which
Note: I'm using Rails 2.3.8, not 3. I have a Photo model with a
NOTE: Updated and rewritten This question has been redone and updated. Please pardon outdated

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.