简体   繁体   English

IOS7中的PushViewController崩溃

[英]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. 当我尝试在运行IOS6的xcode5中运行旧应用程序时,我在IOS7中遇到一个奇怪的问题,但是当我尝试将Nextview崩溃时这是IOS7,这是我的应用程序崩溃的代码。

 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 . 有趣的是,当我使用presentViewController而不是pushViewController呈现视图时,它在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 ? 所以问题是为什么在iOS7中pushViewController引起问题? Any help will be appreciated.Thanks in advance. 任何帮助将不胜感激。

Edit: For more Detail see my app Flow 编辑:有关更多详细信息,请参阅我的应用程序流程 这里 and here is my AppDelegate Code 这是我的AppDelegate代码

- (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 不要忘了为NavigationController声明您的第一个viewController

in iOS6 it wasn't a big problem. 在iOS6中,这不是一个大问题。 In iOS7 it is ! 在iOS7中

have a look to 看看

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

You can push only if you have a root! 您只有在拥有根的情况下才能推送!

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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