iphone - UINavigationController app crashes when clicking the "back" button -


hoping can me.

in didselectrowatindexpath method, loading , pushing detail view controller, when tap "back" button in detail view go root view, app crash. no error logs or anything.

i'm 95% sure it's got "rides" object being released early, can't figure out.

thanks 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 

define nsstring's in header, place them in cellforrowatindexpath:


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -