1

I have a UINavigationController that displays several buttons on screen. They all simply use the line:

myViewController *newView = [[myViewController alloc] initWithNibName:@"myViewController"
                                                                          bundle:nil];
[[self navigationController] pushViewController:newView animated:YES];

to transition to the next view. I have one such view controller however that results in a crash at this very line ONLY on iOS 5. It works perfectly fine on iOS 6. I am baffled. There are no real details to the crash. It is a SIGABRT that highlights the main.m line:

exitStatus = UIApplicationMain( argc, argv, nil, NSStringFromClass([ApplicationDelegate class]));

I have no clue...

4

3 回答 3

5
  1. 您需要取消选中自动布局。

在此处输入图像描述

  1. 并确保您也在此处进行更改.. 选择 ios 5.1

在此处输入图像描述

于 2012-12-05T04:32:56.133 回答
0

我已经尝试了一个类似的问题,这里是我认为需要考虑的步骤:

  • (如果您使用的是 xib 文件)就像提到的Venkat Manohar Perepa一样,请检查 Use Auto Layout 是否已关闭,因为它是 iOS 6 的特定功能。
  • (如果您使用的是 xib 文件)查看显示视图控制器时使用的 xib 文件的内容,并检查是否没有特定于 iOS6 的类(例如:NSLayoutConstraint)
  • 最后(这就是我面临的问题)您应该检查崩溃是否出现在安装了 iOS5 的设备上。如果它没有但仍然在模拟器上崩溃,请通过选择 iPhone Simulator > Reset Content and Settings 删除您已安装的应用程序。
于 2013-04-22T12:25:37.877 回答
0

试试这条线:

myViewController *newView = [[myViewController alloc] initWithNibName:@"myViewController"
                                                                              bundle:[NSBundle mainBundle]];

代替:

myViewController *newView = [[myViewController alloc] initWithNibName:@"myViewController"
                                                                          bundle:nil];
于 2012-12-05T06:34:44.413 回答