ios - Xcode 5 与 iOS 7 : 'Story Board: There are unexpected subviews in the container view.' 中的 NSInternalInconsistencyException

标签 ios iphone objective-c xcode uistoryboard

我刚刚安装了带有 OS X Mavericks 的 Xcode 5.0.2。在 Xcode 4.5 上运行最初为 iOS 5.1 构建的项目时,出现“NSInternalInconsistencyException”错误,如下所示:

*** Assertion failure in -[UIStoryboardEmbedSegue perform],    
/SourceCache/UIKit_Sim/UIKit-2903.23/UIStoryboardEmbedSegue.m:19

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', 
reason: 'There are unexpected subviews in the container view.  
Perhaps the embed segue has already fired once or 
a subview was added programmatically?'

我所做的是解决显示的与已弃用 API 相关的任何警告,但我仍然面临这个问题。

我的问题是:

  • 我如何确定是哪个 Storyboard场景导致了这个问题?
  • 另外,有什么推荐的方法可以解决这个问题吗?

注意:我注意到我在 xCode 5 中使用 iOS 7 作为基础 SDK,而在 xCode 4.5 上它曾经是 iOS 6,但两者的部署目标都设置为 6.0。将 Xcode 5 中的部署目标更改为其他 SDK 版本并未解决该问题。

注意 2:我注意到在适用于 iOS 6 的 iPhone 模拟器上的 Xcode 4.5 上运行并且 Base SDK 设置为 iOS 6.0 时不会发生此问题。

Storyboard截图 storyboard screenshot (sample) Table View Controller 有一个容器 View ,带有一个到 View Controller 的“embed segue”。

最佳答案

我想通了。

我的 UI 是怎样的

我正在为 iPhone 和 iPad 创建一个通用应用程序,并为这些设备中的每一个提供 Storyboard。 我有一个连接到导航 Controller 的选项卡栏 Controller ,然后连接到一个 UITableViewController,它在静态单元格中显示一个表(为了让最上面的行显示标题)。在这个 UITableViewController 中,我有一个容器 View (使用自定义类 MyApp_UITableViewCell 设置),它显示许多动态行。

原因

问题是由于容器 View 被设置为具有自定义类:MyApp_BIUiTableViewCell。通过在 Storyboard 中删除对该自定义类的引用,问题得到解决

我是如何解决的

  1. 将基础 SDK 和部署目标更改为 iOS 7。

  2. 在每个设备的 Storyboard中:我删除了每个容器 View (设置为 MyApp_UITableViewCell)的身份检查器中的引用自定义单元格

我的推荐

对于类似的问题,我能说的是检查自定义类集并尝试(一个接一个地)删除它们。另外,尝试注释掉每个 viewDidload 和 viewDidappear 内容,看看问题是在哪里引起的。

关于ios - Xcode 5 与 iOS 7 : 'Story Board: There are unexpected subviews in the container view.' 中的 NSInternalInconsistencyException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20030356/

相关文章:

iphone - 适用于 iPhone 的星巴克/iPod 景观式图像浏览器

ios - Objective c UIImageView 动画

iphone - 如何确定 UITextField 中删除的位置

ios - UITextField 获得焦点,然后由于在 textFieldShouldReturn 中返回 YES 而立即失去焦点

ios - Table view cell height based on Dynamic height Table Height问题

ios - ScrollView - 手势识别器 - 垂直滑动

iphone - iPhone 中我的目录路径中的文件夹名称

ios - 为导航栏创建一个粘性 View

iphone - 将导航 Controller 添加到 Split View中的详细 View

iphone - 检测以编程方式创建的控件中的 iOS UI 事件