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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:43:26+00:00 2026-05-25T01:43:26+00:00

I’m new to Xcode, so bear with me: I have a table view that

  • 0

I’m new to Xcode, so bear with me:

I have a table view that I’m trying to reload once the NSURLConnection succeeds. I have a number of messages that help me guide me along the way… but when I call the reload upon the table view, the table doesn’t repopulate.

JsonViewController.h:

#import <UIKit/UIKit.h>

@interface JsonViewController : UITableViewController {
    NSMutableArray *theTweets;
    IBOutlet UITableView *tview;
    NSMutableData *responseData;
}

@property (nonatomic, retain) NSMutableArray *theTweets;
@property (nonatomic, retain) UITableView *tview;

@end

JsonViewController.m:

#import "JsonViewController.h"
#import "SBJson.h"

@implementation JsonViewController
@synthesize theTweets;
@synthesize tview;

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
     // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}

- (void) dealloc {
    [theTweets release];
    [super dealloc];

}

- (NSMutableArray*)theTweets {
    return [[theTweets retain] autorelease];
}

- (void) setTheTweets:(NSMutableArray *)newTweets {
    if (newTweets != theTweets) {
        [newTweets retain];
        [theTweets release];
        theTweets = newTweets;
        NSLog(@"Setting new tweets...");
        [tview reloadData]; 

    }
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];

    tview.delegate = self;

    responseData = [[NSMutableData data] retain];
    theTweets = [NSMutableArray array];
    NSURLRequest *request = [NSURLRequest requestWithURL:
                         [NSURL URLWithString:@"http://search.twitter.com/search.json?q=AriaPoker&result_type=recent"]];

    [[NSURLConnection alloc] initWithRequest: request delegate:self];
    NSLog(@"Trying to get feed upon initialization");
}

- (void)viewDidUnload
    {
        [super viewDidUnload];
        // Release any retained subviews of the main view.
        // e.g. self.myOutlet = nil;
    }

// methods that are not important

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
    {
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    NSLog(@"Number of the tweets count at this point: %d", [theTweets count]); 
    return [theTweets count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    NSLog(@"Number of the tweets count at this point: %d", [theTweets count]); 

    // Configure the cell...
    NSDictionary *aTweet = [theTweets objectAtIndex:[indexPath row]];
    //cell.textLabel.text = [aTweet objectForKey:@"text"];
    cell.textLabel.adjustsFontSizeToFitWidth = YES;
    cell.textLabel.font = [UIFont systemFontOfSize:12];
    cell.textLabel.numberOfLines = 4;
    cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;

    cell.textLabel.text = @"Test";
    cell.detailTextLabel.text = @"haha";

    //NSURL *url = [NSURL URLWithString:[aTweet objectForKey:@"profile_image_url"]];
    //NSData *data = [NSData dataWithContentsOfURL:url];
    //cell.imageView.image = [UIImage imageWithData:data];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;    

    return cell;
        NSLog(@"Loading cells in table");
}


#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Navigation logic may go here. Create and push another view controller.

}

#pragma mark NSURLConnection Delegate Methods
- (void) connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
    [responseData setLength:0];
}

- (void) connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
    [responseData appendData:data];
}

- (void) connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
    //do nothing
    NSLog(@"A connection error has occurred!");
}

- (void) connectionDidFinishLoading:(NSURLConnection *)connection {
    [connection release];
    NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
    [responseData release];

    NSDictionary *results = [[responseString JSONValue] retain];
    NSLog(@"Number of Rows: %d", [results count]);


    NSMutableArray *allTweets = [results objectForKey:@"results"];

    //[viewController setTweets:allTweets];

    theTweets = allTweets;

    NSLog(@"Number of misc2: %d", [theTweets count]); 
    [results release];
    [tview reloadData];

}

@end

I’m wondering what I’m doing wrong here.

  • 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-25T01:43:26+00:00Added an answer on May 25, 2026 at 1:43 am

    In connectionDidFinishLoading change from this:

    theTweets = allTweets;
    

    to this:

    self.theTweets = allTweets;
    

    or this way if you prefer:

    [self setTheTweets:allTweets];
    

    You weren’t invoking the setter method, so it wasn’t getting retained.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
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
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.