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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:39:27+00:00 2026-05-20T00:39:27+00:00

hoping someone can help me. In the didSelectRowAtIndexPath method, I am loading and pushing

  • 0

hoping someone can help me.

In the didSelectRowAtIndexPath method, I am loading and pushing detail view controller, when you tap the “back” button in the detail view to go back to the root view, the app will crash. No error logs or anything.

I’m 95% sure it’s got something to do with the “rides” object being released too early, but can’t figure it out.

Thanks for your help!

#import "RidesViewController.h"
#import "RideDetailViewController.h"
#import "JSON.h"

@implementation RidesViewController
@synthesize rides;

#pragma mark -
#pragma mark View lifecycle
- (void)viewDidLoad {

    [super viewDidLoad];

    self.tableView.backgroundView   = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"table-view-background.png"]];

    rides                           = [[NSDictionary alloc] init];

    NSString        *filePath       = [[NSBundle mainBundle] pathForResource:@"rides" ofType:@"JSON"];
    NSData          *jsonData       = [NSData dataWithContentsOfFile:filePath];  
    NSString        *responseString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];

    NSDictionary    *results        = [responseString JSONValue];

    rides                           = [results objectForKey:@"rides"];

    [rides retain];
}

#pragma mark -
#pragma mark Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

    return 1;
}

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

    return [rides 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];

    cell.textLabel.text     = [[rides valueForKey:@"title"] objectAtIndex:indexPath.row];
    cell.accessoryType      = UITableViewCellAccessoryDisclosureIndicator;

    return cell;
}

#pragma mark -
#pragma mark Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    [tableView deselectRowAtIndexPath:indexPath animated:YES];

    RideDetailViewController *rideDetailViewController = [[RideDetailViewController alloc] initWithNibName:@"RideDetailViewController" bundle:nil];

    NSString        *aTitle         = [[NSString alloc] initWithString:[[rides valueForKey:@"title"] objectAtIndex:indexPath.row]];
    NSString        *aImagePath     = [[NSString alloc] initWithString:[[rides valueForKey:@"imagePath"] objectAtIndex:indexPath.row]];
    NSString        *aDescription   = [[NSString alloc] initWithString:[[rides valueForKey:@"description"] objectAtIndex:indexPath.row]];
    NSString        *aVideoPath     = [[NSString alloc] initWithString:[[rides valueForKey:@"videoPath"] objectAtIndex:indexPath.row]];

    [rideDetailViewController initWithTitle:aTitle imagePath:aImagePath description:aDescription videoPath:aVideoPath];

    [self.navigationController pushViewController:rideDetailViewController animated:YES];

    [rideDetailViewController   release];
    [aTitle                     release];
    [aImagePath                 release];
    [aDescription               release];
    [aVideoPath                 release];
}

#pragma mark -
#pragma mark Memory management
- (void)didReceiveMemoryWarning {

    [super  didReceiveMemoryWarning];
}

- (void)dealloc {
    [super  dealloc];
}


@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-05-20T00:39:28+00:00Added an answer on May 20, 2026 at 12:39 am

    Define your NSString‘s in your header, then place them in cellForRowAtIndexPath:

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

Sidebar

Related Questions

Hoping someone can help me out with some pretty erratic behaviour from omnicomplete in
Hoping someone can help me with the LINQ syntax to calculate an average. For
I am hoping someone can help me this this problem. I know how to
I'm hoping someone can help me out here - I'm testing some javascript and
I am hoping someone can help me come up with a pattern to get
I'm hoping someone can help me figure out what the pros and cons are
I am hoping someone can help me. I have a very simple question, but
I'm hoping someone can help me with this. When I'm styling html components say
So I've already got this working but I'm hoping someone can help me optimize

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.