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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:45:28+00:00 2026-05-15T16:45:28+00:00

I am new to objective c and I guess it has to do with

  • 0

I am new to objective c and I guess it has to do with me not understanding pointers or something, but I cannot access a variable outside the class it was declared in.

I know this is a ridiculous question, but I need help.

I have something as simple as an NSString which depending on which tablecell row is selected it grabs the name and stores it in the string. The thing is , I need this string available in another class where the file needs to be loaded using String value. I just get a string is nul or nil whatever error.

I have tried property, synthesize, imports, @class but I guess I dont know what the true meaning of those things are.

Please point me in the right direction.


In libraryTableViewController I declare

NSString *fileToLoad;
@property (nonatomic, retain) NSString *fileToLoad; 

in the .m I @synthesize fileToLoad; then in the didSelectRowAtIndexPath method I fileToLoad = @"%@", [categories objectAtIndex:row];

The problem is in another view controller class I want to load from tableViewData plist

NSString *myFile = [[NSBundle mainBundle] pathForResource:fileToLoad ofType:@"plist"];

but just get nil; ?

  • 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-15T16:45:29+00:00Added an answer on May 15, 2026 at 4:45 pm

    If the code is in another class or instance, you don’t have magical access to similarly named properties of other classes/instances – the documentation on declared properties might help clear misunderstandings.
    In your second instance, fileToLoad is probably nil because it was never initialized there.

    You need to have a reference to the instance you want to have the value from and retrieve the property value:

    NSString *myFileToLoad = myTableViewController.fileToLoad;
    

    Depending on your architecture there might also be other/better solutions.

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

Sidebar

Related Questions

I'm fairly new to Objective-C and am not sure how to correctly deal with
When create the new objective-c class UIViewController file. I want to know which command/
I am an Objective-C newbie, who still does not have a Mac, but still
First of all, I am a a very new Objective C/Cocoa iOS Developer but
I'm new to Objective-C and development on Apple's platforms, but hopefully I can frame
New to objective-C, #import <objc/objc.h> #import <Foundation/Foundation.h> @interface Test:NSObject { int x,y, abc; NSString
Fairly new to Objective C and trying to work within Storyboards given it's the
I'm new to objective C and I just wanted to get a general clarification
I am new to Objective C and iPhone development. I am using CoreData on
I'm new to Objective-C and Cocoa. I've read that NSInteger and NSNumber are preferred

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.