objective c - EXC_BAD_ACCESS although objects are not freed? -
i have following problem in code:
uitableviewcontroller *controller = nil; switch (indexpath.row) { case 0: controller = self.kundentableviewcontroller; break; case 1: controller = self.projektetableviewcontroller; break; case 2: controller = self.leistungentableviewcontroller; break; case 3: controller = self.zeitentableviewcontroller; break; } [self.navigationcontroller pushviewcontroller:controller animated:yes]; all 4 view controllers defined in .h-file , synthesized manually (and yes, same, double checked):
- (leistungentableviewcontroller*)leistungentableviewcontroller { if (leistungentableviewcontroller == nil) { // neu erzeugen leistungentableviewcontroller = [[leistungentableviewcontroller alloc] initwithnibname:@"leistungenlisteview" bundle:nil]; } return leistungentableviewcontroller; }
now, strange happens: if case 0: called, controller becomes self.kundentableviewcontroller. exc_bad_access @ last line, view controller pushed onto stack. happen particular controller, not other ones. tried nszombies , checked via nslog whether controller gets initialized properly, seems fine. ideas?
update: here's code 4 controllers:
- (kundentableviewcontroller*)kundentableviewcontroller { if (kundentableviewcontroller == nil) { // neu erzeugen kundentableviewcontroller = [[kundentableviewcontroller alloc] initwithnibname:@"kundenlisteview" bundle:nil]; } return kundentableviewcontroller; }
- (leistungentableviewcontroller*)leistungentableviewcontroller { if (leistungentableviewcontroller == nil) { // neu erzeugen leistungentableviewcontroller = [[leistungentableviewcontroller alloc] initwithnibname:@"leistungenlisteview" bundle:nil]; } return leistungentableviewcontroller; }
- (projektetableviewcontroller*)projektetableviewcontroller { if (projektetableviewcontroller == nil) { // neu erzeugen projektetableviewcontroller = [[projektetableviewcontroller alloc] initwithnibname:@"projektelisteview" bundle:nil]; } return projektetableviewcontroller; }
- (zeitentableviewcontroller*)zeitentableviewcontroller { if (zeitentableviewcontroller == nil) { // neu erzeugen zeitentableviewcontroller = [[zeitentableviewcontroller alloc] initwithnibname:@"zeitenlisteview" bundle:nil]; } return zeitentableviewcontroller; }
i can't figure out why happens first one.
sounds goes wrong intialization of nib file, in particular once -loadview method called (which happens before view controller displayed , responsible hooking iboutlets proxy objects). sure every iboutlet connected , view connected well? might want check nibs.
Comments
Post a Comment