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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:07:30+00:00 2026-06-06T14:07:30+00:00

This is my sample twitter program it works but there are several errors if

  • 0

This is my sample twitter program it works but there are several errors
if I scroll up or down top and bottom cellls disappears some times I get an error saying :

BAD ACCESS CODE this happens on this row

NSDictionary *tweet = [tweets objectAtIndex:indexPath.row];

Please Advice

enter image description here

#import "TableViewViewController.h"

@interface TableViewViewController ()

@end

@implementation TableViewViewController

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    NSLog(@"tweets array count : %d", tweets.count);
    return tweets.count;
}

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

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

    NSLog(@"ROW : %d", indexPath.row);

    NSDictionary *tweet = [tweets objectAtIndex:indexPath.row];
    NSString *text = [tweet objectForKey:@"text"];
    NSString *name = [[tweet objectForKey:@"user"] objectForKey:@"name"];

    cell.textLabel.text = text;
    cell.detailTextLabel.text = [NSString stringWithFormat:@"by %@", name];
    return cell;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self fetchTweets];
}

- (void)fetchTweets
{

    NSString *twitterURL = [NSString stringWithFormat:@"https://api.twitter.com/1/statuses/public_timeline.json"];    
    NSURL *fullURL = [NSURL URLWithString:twitterURL];

    NSError *error = nil;
    NSData *dataURL = [NSData dataWithContentsOfURL:fullURL options:0 error:&error];

    tweets  = [NSJSONSerialization JSONObjectWithData:dataURL
                                                      options:kNilOptions
                                                        error:&error];    
}

.....

@end
  • 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-06T14:07:33+00:00Added an answer on June 6, 2026 at 2:07 pm

    Found out the answer My app doesn’t support ARC because I didn’t check if we use a retain at the NSJSONSerialization the error is fixed.

     tweets  = [[NSJSONSerialization JSONObjectWithData:dataURL
                                                          options:kNilOptions
                                                            error:&error] retain];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This example works fine (without parameters): JSONP sample on twitter <html><head><title>Twitter 2.0</title> <script type=text/javascript
I found this sample but its for web. Can any one check this proj.
Hello im tryin to use Twitter with OAuth but i receive this exception Authorization
couldn't find a similar topic but this may boil down to not knowing how
I follow this link site to integrate Twitter on Android. But the problem is
Let's say I have a following string from twitter: This is my sample test
I'm implementing a Feed Project basically using Three20 Twitter sample as my reference but
Consider this sample class, class TargetClass { private static String SENSITIVE_DATA = sw0rdfish; private
In this sample code the URL of the app seems to be determined by
in this sample method/message: -(void) setNumerator:(int) n { numerator = n; } What does

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.