objective c - EXC_BAD_ACCESS in didSelectRowAtIndexPath -



objective c - EXC_BAD_ACCESS in didSelectRowAtIndexPath -

i have overwritten uitableviewcontroller didselectrowatindexpath method next way:

- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { photolistviewcontroller *photosviewcontroller = [[photolistviewcontroller alloc] initwithstyle:uitableviewstyleplain]; nslog(@"let's see got %d", [[fetchedresultscontroller fetchedobjects] count]); person *person = [fetchedresultscontroller objectatindexpath:indexpath]; photosviewcontroller.person = person; photosviewcontroller.title = [person.name stringbyappendingstring:@"'s photos"]; [self.navigationcontroller pushviewcontroller:photosviewcontroller animated:yes]; [photosviewcontroller release]; }

whenever seek access fetchedresultscontroller crash, set here:

- (id)initwithstyle:(uitableviewstyle)style { self = [super initwithstyle:style]; if (self) { nspredicate *predicate = [nspredicate predicatewithformat:@"person = %@", person]; fetchedresultscontroller = [[flickrfetcher sharedinstance] fetchedresultscontrollerforentity:@"photo" withpredicate:predicate]; } homecoming self; }

and release in dealloc method

seems autorelease pool getting drained before didselectrowatindexpath method called. did seek retaining fetchedresultscontroller so:

fetchedresultscontroller = [[[flickrfetcher sharedinstance] fetchedresultscontrollerforentity:@"photo" withpredicate:predicate] retain];

objective-c ios uitableview exc-bad-access didselectrowatindexpath

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -