Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/101.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UINavigationController:应用程序冻结_Ios_Xcode - Fatal编程技术网

Ios UINavigationController:应用程序冻结

Ios UINavigationController:应用程序冻结,ios,xcode,Ios,Xcode,在myAppDelegate.m中: MainViewController *mainViewController = [ [MainViewController alloc] init]; UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:mainVi

在myAppDelegate.m中:

MainViewController *mainViewController         = [ [MainViewController alloc] init];
UINavigationController *navController = [[UINavigationController alloc]
                                         initWithRootViewController:mainViewController];

[navController setNavigationBarHidden:YES];
[[self window] setRootViewController:navController];
在MainViewController.m中,没有什么特别的,只有一个与按钮相关的操作:

- (IBAction)go:(id)sender {
   if (!whereamiViewController)
   {
      whereamiViewController = [[WhereamiViewController alloc] init];
   }
   [[self navigationController] pushViewController:whereamiViewController animated:YES];

}
在其中,miviewcontroller.m只是一个按钮,用于显示UINavigationViewController中的另一个屏幕:

-(IBAction)showList:(id)sender
{

PointsViewController *container = [[PointsViewController alloc] init];
[[self navigationController] pushViewController:container animated:YES];
}
以及:

一切都好。但是当我在最后一个屏幕上着陆时,指向iewcontroller,然后我回到miview,应用程序冻结,Xcode在courefundation,CFHas显示了一个陷阱

现在,我知道Objective-C不是php,但这确实是一个简单的例子:我缺少什么?有没有一种方法可以调试这个问题

调试器说:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-  [__NSCFType _forgetDependentConstraint:]: unrecognized selector sent to instance 

今天早上我在模拟器中运行了应用程序,没有崩溃!!怎么可能呢?如果我在iPhone崩溃中运行,在模拟器中没有崩溃。

我没有真正看到问题在哪里,因为它发生在您发布的代码之外。我可能遗漏了一些东西,但是如果当你返回到
wheremiviewcontroller
时应用程序崩溃,你实际上如何返回?我不知道这里的细节在哪里

像这样使用
navigationControllers
,您可以按(添加)或弹出(删除)
viewControllers
在navcontroller树上下移动。就在这个时候,这个应用程序似乎要崩溃了,也许值得发布一下你是怎么做到的?在哪里弹出容器(PointsViewController*)


从您发布的代码来看,我怀疑您可能试图通过再次按下miviewcontroller返回到它所在的位置。

蒂姆是对的。弹出PointsViewController也是我的方法

你的Xcode在说什么?你能提供调试器的内容吗? 这将更有助于找出问题所在。

[部分解决]
这是非常奇怪的:在调试了所有内容并删除了所有可疑的声明之后,没有任何改进。同样的碰撞信号。重新启动iPhone和Mac后,一切正常

代码之外没有什么特别的东西。但你说得对,也许我没看什么。但是,我只需按下UINavigationBar顶部自动显示的后退按钮,就可以返回到MiViewController。我在帖子中添加了调试器的错误消息。该错误描述了当您尝试调用不存在的方法时的实例。错误消息如下:由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'-[\uNscftype\uForgetDependentConstraint:]:未识别的选择器发送到实例
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-  [__NSCFType _forgetDependentConstraint:]: unrecognized selector sent to instance