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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:29:10+00:00 2026-05-26T09:29:10+00:00

An array is filled properly but when I try to access to content again,

  • 0

An array is filled properly but when I try to access to content again, seems that is empty again!! trying to post as many code as necessary. Thanks for help.

I declare appData in .h file:

@interface userViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> {

    NSArray *appData;

    IBOutlet UIActivityIndicatorView *activityIndicator;
    IBOutlet UILabel *status;
    IBOutlet UITableView *mainTable;
}

@property (nonatomic, retain) NSArray *appData;
@property (nonatomic, retain) UIActivityIndicatorView *activityIndicator;
@property (nonatomic, retain) UILabel *status;
@property (nonatomic, retain) UITableView *mainTable;


- (IBAction) refresca: (id)sender;

- (void)getData: (NSString *)usuari: (NSString *)clau;

@end

in .m file is synthesized and released. appData is properly filled when connection request ends and then, when I reload tableview, when numberOfRowsInSection executed (while loop also in order to test), appData is empty!

- (void)requestFinished:(ASIHTTPRequest *)request {
    NSLog(@"%@", [request responseString]);

    self.appData = [[request responseString] componentsSeparatedByString: @"#"]; 

    int x =0;

    while (x<[appData count] - 1)
    {
        NSLog(@"Aplicaciones = %@",[appData objectAtIndex: x]);
        x = x+1;
    }

    [activityIndicator stopAnimating];
    activityIndicator.hidden = YES;
    status.hidden = YES;
    mainTable.hidden = NO;

    [mainTable reloadData];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{     
    if ([appData count] != 0)
    {
        NSLog(@"Counter = %@",[appData objectAtIndex:0]);
    }

    return [appData count]-1;
}
  • 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-26T09:29:11+00:00Added an answer on May 26, 2026 at 9:29 am

    A couple of things here.

    Your test logging in numberOfRows will cause the app to hang if appdata ever has a non-zero count.

    Are you sure you are getting the the same appData object that you populate in requestFinished ?

    I suggest using the accessor in numberOfRows as in [self.appData count] which might sort out the problem.

    And is there a specific reason you subtract one from the count? As you will lose one element from the array in the tableView that way

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

Sidebar

Related Questions

Basically, I am trying this, but this only leaves array filled with zeros .
I have a byte array filled from a file uploaded. But, in another part
Here is my code, which creates 2d array filled with zeros, array dimensions are
I have a perl script that writes out an array filled with integers to
So, i have this code that seems to be doing the mechanical work correctly,
I have dynamic array filled with bytes, which are read from .raw file with
I'm creating a numpy array which is to be filled with objects of a
I have 3 arrays of data, that are filled by reading off of an
Array.Copy and Buffer.BlockCopy both do the same thing, but BlockCopy is aimed at fast
I have an array filled with instances of a custom class which contains two

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.