gpt4 book ai didi

iOS7 中的导航 Controller 中不允许使用 UINavigationControllers

转载 作者:行者123 更新时间:2023-12-04 08:42:07 27 4
gpt4 key购买 nike

我的一个应用程序拒绝启动并在 iOS7 中遇到此异常。 excetion中的措辞看起来像工程师发脾气,尤其是感叹号。该代码在 iOS 5/6 中运行良好,并且没有与之关联的警告。 xcode 5 中没有警告。包括一个缩写的代码片段。我这样做的原因是创建我自己的自定义标签栏,它控制应用程序的整个导航。

2013-06-10 22:24:52.862 [3375:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'UINavigationControllers are not allowed in a navigation controller!'

*** First throw call stack:
(0x2c56028 0x29da902 0x1009873 0x2cd22fd 0x2cd2232 0x2c4fae5 0x1009716 0x100943f 0x1008ec5 0x9905 0xef05f9 0xef0daa 0xef21dc 0xf07c6c 0xf081d9 0xef3e55 0x3d6ace2 0x3d6a7ed 0x2bd18d5 0x2bd160a 0x2bfc032 0x2bfb59f 0x2bfb3eb 0xef1960 0xef3b6b 0x8e2d 0x8d95)
libc++abi.dylib: terminating with uncaught exception of type NSException

代码:

UIViewController *homeController, *contactController, *procedureController, *wizardController, *teamController, *askController;

homeController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
UINavigationController *homeNavController = [[UINavigationController alloc] initWithRootViewController:homeController];

wizardController = [[ProcedureWizardController alloc] initWithNibName:@"ProcedureWizardController" bundle:nil];
UINavigationController *wizardNavController = [[UINavigationController alloc] initWithRootViewController:wizardController];

askController = [[AskViewController alloc] initWithNibName:@"AskViewController" bundle:nil];
UINavigationController *askNavController = [[UINavigationController alloc] initWithRootViewController:askController];

teamController = [[TeamViewController alloc] initWithNibName:@"TeamViewController" bundle:nil];
UINavigationController *teamNavController = [[UINavigationController alloc] initWithRootViewController:teamController];

procedureController = [[ProcedureViewController alloc] initWithNibName:@"ProcedureViewController" bundle:nil];
UINavigationController *procNavController = [[UINavigationController alloc] initWithRootViewController:procedureController];


contactController = [[ContactViewController alloc] initWithNibName:@"ContactViewController" bundle:nil];
UINavigationController *contactNavController = [[UINavigationController alloc] initWithRootViewController:contactController];

viewControllers = [NSArray arrayWithObjects:homeNavController, wizardNavController, askNavController, teamNavController, procNavController, contactNavController, nil];

navController = [[UINavigationController alloc] init];;

navController.viewControllers = [NSArray arrayWithArray:viewControllers];

最佳答案

异常是正确的。 Apple 显然修复了 iOS7 中 4,5 和 6 中未发现的问题。

不要嵌套 UINavigationControllers。

关于iOS7 中的导航 Controller 中不允许使用 UINavigationControllers,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17037395/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com