XCode AppDelegate在5.0模拟器中返回sigabrt,但在4.3中工作正常

时间:2012-06-20 12:24:07

标签: iphone xcode xcode4.2 ios-simulator sigabrt

我将我的XCode更新为4.2,并希望使用Simulator 5.0而不是4.3。

我使用5个标签编写了一个标签栏应用程序,但是通过appdelegate将另一个视图作为第一个视图推送。

现在我遇到的问题是它在模拟器4.3中运行良好,但在模拟器5.0中出现错误:

int retVal = UIApplicationMain(argc, argv, nil, nil); SIGABRT

objc[3441]: EXCEPTIONS: throwing 0x7d626b0 (object 0x7d1e750, a NSException)
objc[3441]: EXCEPTIONS: searching through frame [ip=0xe99ee sp=0xbfffdee0] for exception 0x7d62690
objc[3441]: EXCEPTIONS: catch(id)
objc[3441]: EXCEPTIONS: unwinding through frame [ip=0xe99ee sp=0xbfffdee0] for exception 0x7d62690
objc[3441]: EXCEPTIONS: handling exception 0x7d62690 at 0xe9bac
objc[3441]: EXCEPTIONS: finishing handler
objc[3441]: EXCEPTIONS: throwing 0x7d5cd30 (object 0x7d1e750, a NSException)
objc[3441]: EXCEPTIONS: searching through frame [ip=0xe9b9c sp=0xbfffdee0] for exception 0x7d5cd10
objc[3441]: EXCEPTIONS: searching through frame [ip=0x1a02db3 sp=0xbfffec20] for exception 0x7d5cd10
objc[3441]: EXCEPTIONS: unwinding through frame [ip=0xe9b9c sp=0xbfffdee0] for exception 0x7d5cd10
objc[3441]: EXCEPTIONS: unwinding through frame [ip=0x1a02db3 sp=0xbfffec20] for exception 0x7d5cd10
objc[3441]: EXCEPTIONS: handling exception 0x7d5cd10 at 0x1a02e46
objc[3441]: EXCEPTIONS: rethrowing current exception
objc[3441]: EXCEPTIONS: searching through frame [ip=0x1a02e0f sp=0xbfffec20] for exception 0x7d5cd10
objc[3441]: EXCEPTIONS: unwinding through frame [ip=0x1a02e0f sp=0xbfffec20] for exception 0x7d5cd10
objc[3441]: EXCEPTIONS: finishing handler
objc[3441]: EXCEPTIONS: unwinding through frame [ip=0x1a02e38 sp=0xbfffec20] for exception 0x7d5cd10

我将问题本地化在AppDelegate中:

AppDelegate *app = [AppDelegate getApp];
    app.tabController.selectedViewController = connNavController;

我还尝试使用

推送控制器
[self.navigationController pushViewController:myViewController animated:YES];

但我总是得到一个SIGABRT。

清洁目标,重新启动等不起作用。

如果您有解决方案,请提供帮助。

谢谢!

2 个答案:

答案 0 :(得分:1)

你试过替换

吗?
UIApplicationMain(argc, argv, nil, nil);

UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));

答案 1 :(得分:0)

您可以从堆栈跟踪中判断一下,但是当您使用属性selectedViewController时,查看控制器大部分位于viewcontrollers的{​​{1}}数组中,如果它不在数组会像这种情况一样抛出错误。

因此,请确保您的代码中包含此内容:

UITabBarController