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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:32:33+00:00 2026-05-16T21:32:33+00:00

I got same warning here local declaration hides instance variable warning but I got

  • 0

I got same warning here “local declaration hides instance variable” warning

but I got more problems…

Here is my code

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

 NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.someaddress.php"]
             cachePolicy:NSURLRequestUseProtocolCachePolicy
            timeoutInterval:60.0];

 // create the connection with the request
 // and start loading the data
 NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
 NSLog(@"\n\nCONNECTION:   %@", theConnection);
 NSData *returnData = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:nil error:nil]; 
 NSString *listFile = [[NSString alloc] initWithData:returnData encoding:NSASCIIStringEncoding];   

 NSMutableArray *plist = [[NSMutableArray alloc] init];
 plist = [listFile propertyList];

 NSLog( @"\n 1111 plist is \n%@", plist );
   //I can get a plist format data here,But nothing in 2222
 NSLog(@"Now you see me tableView Row Count");
 NSLog(@"TOTAL PLIST ROW COUNT IS    = %i", [plist count]);


 // Return the number of rows in the section.
    return [plist count];
}

and I got Warning here”Local declaration of ‘plist’ hides instance variable“

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

 static NSString *CellIdentifier = @"LightCell";

 LightCell0 *cell =(LightCell0 *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
 if (cell == nil) {
  cell = [[[LightCell0 alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
 }
 // Set up the cell…
 NSLog(@"Now you see me Load Data %i", indexPath.row);

 [cell setSelectionStyle:UITableViewCellSelectionStyleNone];

    //I try to get list data here But RETURN NULL
 NSLog( @"\n 2222 plist is \n %@", plist);

 switch (indexPath.row) {
   case 0:
   if ([plist valueForKey:@"nodeStatus"] == 0){
    cell.lightImageView.image = [UIImage imageNamed:@"lightOff.png"]; 
    NSLog(@"value for key Node Status : %@" ,[self.plists Valuefokey:@"nodeStatus"]);
                            //also return NULL !!
   }

   else if([self valueForKey:@"nodeStatus"] == 1){
    cell.lightImageView.image = [UIImage imageNamed:@"lightOn.png"];
   }
   break;


  case 1:
   cell.lightLocation.text =[plist valueForKey:@"nodeName"] ;
   if ([plist valueForKey:@"nodeStatus"] == 0){
    cell.lightImageView.image = [UIImage imageNamed:@"lightOff.png"];
   }
   else if([plist valueForKey:@"nodeStatus"] == 1){
    cell.lightImageView.image = [UIImage imageNamed:@"lightOn.png"];
   };

   break;
  default:
   break;
 }
 return cell;
}

This is the tow items I create in a plist

{
        category = Light;
        nodeID = 1;
        nodeName = "Living Room";
        nodeStatus = 0;
        nodeTrigger = 0;
        nodeType = "light_sw";
    },
        {
        category = Light;
        nodeID = 2;
        nodeName = Kitchen;
        nodeStatus = 0;
        nodeTrigger = 0;
        nodeType = "light_sw";
    }

So that’s my question ,Why can’t I pass “plist” from

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
      ...
}

to

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
        ...
}

and I use NSMutableArray *plist = [[NSMutableArray alloc] init];

But still appear “Local declaration of ‘plist’ hides instance variable”

???

hope someone can figure out this problem

Best Regards !

  • 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-16T21:32:33+00:00Added an answer on May 16, 2026 at 9:32 pm

    plist = [listFile propertyList];=====>self.plist = [listFile propertyList];
    THAT IS CORRECT

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

Sidebar

Related Questions

I've got another problem in the same code... I'm getting this error: initialization method
I've got two long lists A and B which have the same length but
I got the same problem with the questions here : Tomcat started in eclipse
I want to add watermark on photos while uploading with paperclip I've got same
I 've got the same problem like in this question: SSL Error on Port
jquery-loadmask not working properly in IE8 I got a same problem. It was issue
I got two gridviews in the same page, which basically displays the same type
I got two tables: comments and commentLikes in the same query i count the
If I've got two properties in a class with the same interface type and
I've got a floated list of elements which I want the same height on.

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.