0

The following code works fine from iOS 3.0 to iOS 4.3 simulator but crashes on iOS5

-(void)viewWillAppear:(BOOL)animated { 
 [self.tableView reloadData];
       [super viewWillAppear:animated];

}

-(void)viewDidAppear:(BOOL)animated { 
 [super viewDidAppear:animated];
      [self.navigationController viewDidAppear:animate];

}

I got exc_bad_access in [self.navigationController viewDidAppear:animate] and it makes the app crashes.

It works fine without any problem in the previous verison.

This app is developed in XCode4 with deployment target 3.0. My user just found the app crashes when he upgraded his iPhone with iOS5. I am being able to reproduce theproblem but not sure how to fix it.

Can anybody shed some light?

  • checkout this thres might helpfull for you http://stackoverflow.com/questions/7810288/viewwillappear-being-called-twice-in-ios5 – Ankit Bhardwaj Oct 19 '11 at 04:52

1 Answers1

0

[self.navigationController viewDidAppear:animate]; is the problem here. In iOS 5 it's going to recursively call this view controller's viewDidAppear method over and over until it just crashes. Why exactly do you need to call viewDidAppear manually on your navigation controller? If it's actually necessary to get your code working, you might want to backtrack a bit as something else must be wrong if you're needing to do this.

One other thing that's just good housekeeping: in your viewWillAppear, [super viewWillAppear:animated]; should come first it that method.

NonatomicRetain
  • 301
  • 4
  • 14