“更改选项卡栏的委托”例外 [英] "Changing the delegate of a tab bar" exception

查看:87
本文介绍了“更改选项卡栏的委托”例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序完美的工作在iPhone OS 2.2.1,但是当我试图运行它在iPhone OS 3.0它崩溃。



这里是错误我从控制台获取:

 由于未捕获异常而终止应用程序NSInternalInconsistencyException,原因:更改所管理的选项卡栏'

可能发生这种情况是因为我改变了




这是代码:

(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];

self.view = current_controller.view;
[current_controller viewWillAppear:NO];
[current_controller viewDidAppear:NO];
}

此部分代码中可能发生错误,如果是,它?
为什么会出现这种情况?



事先感谢您,
Ilya。

解决方案

先生。上面的Ernst给人的印象是,他在Ilya的代码中看到了一些东西,这些代码构成了从控制器下面查看视图。这可以让你盯着代码很长一段时间,这不是问题真的在哪里。我在Apple开发者论坛上发布了此问题 http://discussions.apple.com /message.jspa?messageID=10259835#10259835 ,我被告知NSInternalInconsistencyException是.xib文件的问题(在Interface Builder中)。使用这些信息我发现了以下解决方案。我认为一些名字我给这里是通用的,将帮助其他人试图解决这个问题。为了回顾这个问题,xib引用在2.x上编译和运行完美,在3.x上编译,并在你尝试在3.0模拟器中运行应用程序时给出上面的错误消息。我在标签栏中有一个委托。在Interface Builder中查看引用出口我有Multiple,文件的所有者,Tab Bar和Tab Bar Controller作为引用出口。当我从引用Outlets我的应用程序在Simulator 3.0中运行Tab Bar。它也编译并在2.x上运行,因此2.x中不需要Tab Bar引用。 ... Flash Gordon


I have an application that perfectly works on iPhone os 2.2.1 but when I try to run it on iPhone os 3.0 it crushes.

Here is the error I got from the console:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Changing the delegate of a tab bar managed by a tab bar controller is not allowed.'

Probably it occurs because I am changing the view of a certain view controller programmatically.

Here is the code:

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear: animated];

    self.view = current_controller.view;
    [current_controller viewWillAppear: NO];
    [current_controller viewDidAppear: NO];
}

May an error occur in this part of code and if yes how can I fix it? Why else could it occur?

Thank you in advance, Ilya.

解决方案

Mr. Ernst above gives the impression that he sees something in Ilya's code that constitutes "yanking a view out from under a Controller". That can have you staring at code for a long time and that isn't where the problem really is. I posted this problem on the Apple Developer Forum http://discussions.apple.com/message.jspa?messageID=10259835#10259835 and I was told that 'NSInternalInconsistencyException' is a problem with a .xib file (In the Interface Builder). Using this information I found the following solution. I think some of the name's I give here are generic and will give help to others trying to fix this problem. To review the problem, the xib reference compiles and runs perfectly on 2.x, compiles on 3.x and gives the error message above when you try to run the application in the 3.0 simulator. I had a delegate in a tab bar. In viewing the Referencing Outlets in Interface Builder I had "Multiple", "File's Owner", "Tab Bar", and "Tab Bar Controller" as the referencing outlets. When I removed "Tab Bar" from the Referencing Outlets my app ran in Simulator 3.0. It also compiled and ran on 2.x so the "Tab Bar" reference was not required by 2.x. ... Flash Gordon

这篇关于“更改选项卡栏的委托”例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆