简体   繁体   中英

PushViewController Crash in IOS7

I am facing strange issue in IOS7 when I try to run my old app in xcode5 with IOS6 every thing working fine,but with IOS7 when I am trying to Push Nextview it Crash.Here is code where my app Crash.

 FamilyBioViewController *detailView=[[FamilyBioViewController alloc] initWithNibName:@"FamilyBioView" bundle:[NSBundle mainBundle]];
 [self.navigationController pushViewController:detailView animated:YES];
 [detailView release];

When crash happened it did not show any error in console.The below screenshot show the crash result 在此处输入图片说明 Interesting thing is when I present my view with presentViewController instead of pushViewController then it is working fine in IOS 7 .

FamilyBioViewController *detailView=[[FamilyBioViewController alloc] initWithNibName:@"FamilyBioView" bundle:[NSBundle mainBundle]];
 [self presentViewController:detailView animated:YES completion:nil];
 [detailView release];

So the Question is why pushViewController Causing problem in IOS7 ? Any help will be appreciated.Thanks in advance.

Edit: For more Detail see my app Flow 这里 and here is my AppDelegate Code

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
  {
 if(tabBarController.selectedIndex==1 || tabBarController.selectedIndex==3)
 {
    [(UINavigationController *)[tabBarController selectedViewController] popToRootViewControllerAnimated:NO];
}
  }

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
 {
   return YES;
 }
FamilyBioViewController *detailView = [[[FamilyBioViewController alloc] initWithNibName:@"FamilyBioView" bundle:[NSBundle mainBundle]] autorelease];
[self.navigationController pushViewController:detailView animated:YES];

---- EDIT ---- my example above it's not the solution!

don't forget to declare your first viewController for a navigationController

in iOS6 it wasn't a big problem. In iOS7 it is !

have a look to

[[UINavigationController alloc] initWithRootViewController: (UIViewController *)controller]

You can push only if you have a root!

视图控制器数组中的视图控制器必须唯一

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM