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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:13:04+00:00 2026-06-08T06:13:04+00:00

I’ve got 2 types of var in my appDelegate : int and NSMutableArray I

  • 0

I’ve got 2 types of var in my appDelegate : int and NSMutableArray
I can access the int var in my viewController but cannot access the NSMutableArray

Here is the code :

appDelegate.h

#import <UIKit/UIKit.h>  
@interface AppDelegate : UIResponder <UIApplicationDelegate,NINetworkImageViewDelegate,FBSessionDelegate, FBDialogDelegate> 
{
    UIWindow *window;
    UINavigationController *navController;
    int nbNewsNonLues;
    NSMutableArray *tableauNews;

}
@property (strong, nonatomic) NSMutableArray *tableauNews;
@property (nonatomic) int nbNewsNonLues;
@end

these var are well initialized in AppDelegate.m (checked it)

then I try to acces them with this code in ViewController.m

@synthesize appDelegate = _appDelegate;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
        NSLog(@"%@", appDelegate.tableauNews);
        NSLog(@"%d", appDelegate.nbNewsNonLues);
        NSLog(@"%@", appDelegate);
    }
    return self;
}

the log returns

2012-07-23 02:58:21.475 Aviso_0.1[2990:11303] (null)

2012-07-23 02:58:25.432 Aviso_0.1[2990:11303] 2

2012-07-23 02:58:25.432 Aviso_0.1[2990:11303]

So I cant access tableauNews but I can access and modify nbNewsNonlues??

I know this is a noob problem but I read and googled for hours, there must be smthing I missed about delegation

Help needed,

  • 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-08T06:13:05+00:00Added an answer on June 8, 2026 at 6:13 am

    These two lines are not the same:

    NSMutableArray *tableauNews;
    
    @property (strong, nonatomic) NSMutableArray *tableauNews;
    

    In the first one, you create an iVar called tableauNews. In the second one, you create a property called tableauNews with a backing iVar called _tableauNews. Note the under score in the backing iVar: _tableauNews. So you have created two different objects. When you allocate, access, etc. the iVar tableauNews and the property self.tableauNews, you are allocating, accessing two different objects. But the iVar _tableauNews is the same as the property self.tableauNews as noted earlier. To prevent this type of error in the future, the convention is to add a prefix underscore with your iVar.

    Updated to answer the question in comment section:

    In this line @synthetise tableauNews = _tableauNews, that is how you declare a backing iVar (_tableauNews) for the property (tableauNews). When you declare the property tableauNews as above and in the .m file when you try to declare the corresponding @synthesize tableauNews, Xcode automatically suggests the under score version (_tableauNews) as the backing iVar for you so you do not need to declare it (_tableauNews) in the iVars declaration section of the header file. You can however associate your property with your own backing iVar. For example, if in the header file you have declared an iVar called tableauNewsTest then you can theoretically do this in the .m file @synthesize tableauNews = tableuNewsTest. But it is not recommended.

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

Sidebar

Related Questions

Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.